Finding where Python is on a Unix server through Telnet?
Paul Jackson
pj at sgi.com
Mon Jan 3 15:43:55 EST 2000
A portable equivalent to the locate/which/whence/...
confusion (one that I've typed so often I think of
it as a single command) is:
% sh # get a Bourne/Korn/Bash like sub-shell
$ IFS=': ' # add colon ':' to Input Field Separators
$ for i in $PATH
> do
> test -f $i/python && ls -ltd $i/python
> done
-rwxr-xr-x 2 root user 3731188 Jun 11 1999 /usr/local/bin/python
$ exit # leave subshell (with its funky IFS setting)
You don' have to key in the comments each time ;).
And you can skip the "test -f $i/... &&" phrase,
if you'd rather see the ls errors for non-existant
files than type the extra stuff needed to filter them.
And this fails to pick up "aliases" -- for that I think
shell-specific syntax is required.
--
=======================================================================
I won't rest till it's the best ... Software Production Engineer
Paul Jackson (pj at sgi.com; pj at usa.net) 3x1373 http://sam.engr.sgi.com/pj
More information about the Python-list
mailing list