Which script (was Re: comp.unix.questions)

BURNS,JIM gt0178a at prism.gatech.EDU
Sat Sep 22 20:19:37 AEST 1990


in article <574 at DIALix.UUCP>, bernie at DIALix.UUCP (Bernd Felsche) says:

> 	Misteak: The name of the command was test. This is of
> 	course, a builtin in modern shells, so it got executed
> 	without refernce to the PATH at all.

He-he-he.

> 	Perhaps you can tell me which test syntax Dynix is happy
> 	with. (Don't grumble. It takes practice to find prepositions
> 	to end a sentence with :-) )

Basically, our sh seems to use /bin/test. You get the same errors in ksh
if you replace the []'s with /bin/test. It didn't like '-x'. I'll mail you
the relevant man pages from test(1) and ksh(1).

>>-rwxr-x---  1 root        20480 May 21  1988 /bin/wall*
>  ^^^^^^^^^^
> Does this mean that you wouldn't have been able to execute it
> anyway?  If you type "wall", don't you get a permission denied?

Yes.

> The purpose of the which tool is to tell you _which_ command will be
> executed.  It is designed to be quick. It does not attempt to
> interpret functions, aliases or similar creatures.

I'm using it to find out where an executable lives. Useful if your system
has several versions, and which you execute depends on how your PATH is
ordered. And since I *can't* execute wall(1) (or finger(1)) on that
machine, locating it tells me why - it's not that it's not there, just
that it's not world executable. By extension, I have an $ETC variable I
can also search for the occaisional command that's not normally in my
$PATH, like ping(1).
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a at prism.gatech.edu



More information about the Comp.unix.questions mailing list