*BSD News Article 85873


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!vixen.cso.uiuc.edu!uwm.edu!fnnews.fnal.gov!nntp-server.caltech.edu!corvette.mst6.lanl.gov!newshost.lanl.gov!crs
From: crs@lanl.gov (Charlie Sorsby)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: more/page and rsh/hostname symbolic links
Date: 31 Dec 1996 03:20:59 GMT
Organization: Los Alamos National Laboratory
Lines: 79
Message-ID: <5aa0qr$iik@newshost.lanl.gov>
Reply-To: crs@hamlet.lanl.gov
NNTP-Posting-Host: hamlet.lanl.gov
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:33318

Perhaps some of the following will be useful to someone--a small
payback for all the help I've received from the newsgroup and from
FreeBSD developers and users...

Many Unix programs, utilities, and scripts behave differently
depending upon the name they are called with.

When first I began using FreeBSD, I noticed that "page" was missing.
This was always the variant of "more" that I preferred so I decided
to try creating a symbolic link from "more" to "page" and, sure
enough, when called by that name, "more" behaves like "page."  Minor
differences but I'm comfortable with "page."  (Yes, I know about
"more -c").  If anyone else is interested:

# ln -s /usr/bin/more /usr/bin/page

So the "more" code apparently does check to see if it was called as
"more" or as "page" and behaves accordingly.  When I'd seen nothing
about page in the man pages, etc. I was a little worried until I
tried this.

So, today, I got to thinking.  The Suns that I've worked with had
a way to set things up so that one could rlogin to a machine or run
rsh on it by simply entering the name of the machine.  This, too,
is an example of controlling the behavior of a program (in this case
rsh) by the name it is called and, again, uses symbolic links.

If, in a directory in one's path, one creates symbolic links from
/usr/bin/rsh to the names of machines on one's network (or those
that one accesses via ppp), e.g:

ln -s /usr/bin/rsh remote_machine_name

Then entering

% remote_machine_name

is the same thing as entering

% rlogin remote_machine_name

and

% remote_machine_name command

is the same as

% rsh remote_machine_name command

etc.

On the Suns (SunOS 4.x and lower, anyway), the convention is to
place these links in a directory, /usr/hosts, and to put /usr/hosts
in one's path.  That directory and a shell script called MAKEHOSTS
are installed with SunOS.  /usr/hosts/MAKEHOSTS simply checks to
see if NIS (previously Yellow Pages) is running and if it is, uses
the output of "ypcat hosts" to get all the hostnames.  If NIS isn't
running it simply takes them from /etc/hosts.  Whatever the source,
it simply creates a symbolic link from rsh (it's usr/ucb/rsh in
SunOS) to the each hostname in /usr/hosts.

A small but useful convenience if one uses the "r" commands.
Naturally, one wants the short hostname, not the fully qualified
name--i.e. on machine somehost.some.domain, one wants to link to
"somehost" or the shortcut requires more typing than the entire
command.  And, naturally, somehost must be an alias for
somehost.some.domain as defined in either /etc/hosts or NIS.

Well, I don't think there are any blatant errors in the above.
I hope some of it may be useful to someone.

Have a great new year!


-- 
Best,

Charlie "Older than dirt" Sorsby                         "I'm the NRA!"
       crs@swcp.com crs@hamlet.lanl.gov              Life Member since 1965