Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site abnjh.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!abnjh!usenet
From: usenet@abnjh.UUCP (usenet)
Newsgroups: net.unix-wizards
Subject: Re:  more csh path
Message-ID: <489@abnjh.UUCP>
Date: Sat, 3-Mar-84 19:02:37 EST
Article-I.D.: abnjh.489
Posted: Sat Mar  3 19:02:37 1984
Date-Received: Sun, 4-Mar-84 04:41:01 EST
References: <16980@sri-arpa.UUCP>
Organization: ATTIS, NJ
Lines: 28

The following might help for the system V shell, I dont know about the
C-shell.

If there was a command that returned the fully qualified path name of
its first argument relative to the PATH given in its second argument
(default $PATH) it could be used in the following way to deal with the
problem of shell scripts that invoke interactive commands with PATH set
to something the user is not expecting.

lpath=$PATH
PATH=/bin:/usr/bin:/usr/lbin
real_vi=`whereis vi`
PATH=$lpath
$real_vi file-to-edit

The 'whereis' command would look for a file named 'vi' in each of the
directorys named in $PATH, in left to right order, and return the full
path name of the first it found.  For example, in the above
script, 'real_vi' might be set to '/usr/lbin/vi' if the visual
editor resided in /usr/lbin and not in any of the other directorys.

Such a command would be easy enough to write, but it would be faster
(hence more likely to be used when needed) if it were a shell
built-in.

Rick Thomas
ihnp4!abnji!rbt  or  ihnp4!abnjh!usenet