more csh path

usenet usenet at abnjh.UUCP
Sun Mar 4 10:02:37 AEST 1984


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



More information about the Comp.unix.wizards mailing list