|
December 2001
Shell Corner: findp, Enhanced findp, and where
Revisiting PST
Before presenting this month's scripts, I'd like to address a comment from reader Barry Ard (barry.ard@ualberta.ca), who submitted the following constructive criticism concerning October's PST column:
I don't know about about other Unix operating systems, but Solaris, since at least 2.6, provides /usr/proc/bin/ptree that will do the same thing as PST.
Barry is absolutely correct; the output of pstree, part of the /proc virtual file system, is similar to PST. For more information on /proc, see the Sys Admin article, "The /proc File System," by Werner Klauser.
Searching PATH with findp
This month, Robert S. Sciuk (rob@ControlQ.com) submits findp, a Bourne shell script for seaching PATH for a given file. findp takes one or more arguments that are executable files, searches PATH for their location, and displays all matches to standard output.
At first, I was hesitant to use Robert's script, because most Unix variants possess either built-in or external PATH search capabilities. SCO Open Server V and Solaris 7 Korn shells have the built-in search command whence, and Red Hat 7.1 has the external search command which. However, Robert did present a compelling argument:
On FreeBSD, which and whereis are implemented as Perl scripts..
|