It is currently Fri, 15 Oct 2021 21:51:37 GMT

Author Message
 which(1) in Bourne shell scripts?
Is there a version of or substitute for which(1) that can be used in
Bourne shell scripts?

It would seem to be straightforward to write a program to look for
files in a colon-separated list of directories.  And one could add a
lot of bells and whistles.  Has anyone done something like this?

Please e-mail me as I don't usually read this news group.

Stephen G. Simpson     
Department of Mathematics        +1 814 863-0775
Pennsylvania State University    home: +1 814 238-2274
University Park, PA 16802

 Sat, 26 Feb 1994 05:43:49 GMT   
 which(1) in Bourne shell scripts?
In article <-=2Hj$> (Stephen G Simpson) writes:

How about this shell function?

  if [ "$1" = "-a" ]
    type $2 | sed -n '/a function/s/.* is //p'
    for i in $PATH
      if [ -x $i/$2 ]
        echo $i/$2
    type $1 | sed -n '1s/.* is //p' | sed 's/hashed (//' | tr ')' ' '

The mail|    AAA         DDDD  It's not the kill, but the thrill of the chase.
demon...|   AA AAvv   vvDD  DD        Ketchup is a vegetable.
hits!.@&|  AAAAAAAvv vvDD  DD                    {nixbur|nixtor}!adalen.via
--more--| AAA   AAAvvvDDDDDD    Andre van Dalen, uunet!hp4nl!targon!andre

 Fri, 04 Mar 1994 17:27:57 GMT   
   [ 2 post ] 

Similar Threads

1. A Solaris 8 (Bourne Shell) Scripting question, regarding a log rotation script

2. help in learning how to do Bourne shell scripts then converting them to csh scripts

3. book for Bourne shell scripting?

4. Im very close but I need a hint on my bourne shell script

5. how to get uid in Bourne Shell script?

6. HELP! read in Bourne shell script

7. A Simple Bourne Shell Script ?

8. A pointer to Bourne shell scripts at Garbo

9. Problems with Arguments in Bourne Shell Scripts

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software