home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk1.iso
/
altsrc
/
articles
/
10858
< prev
next >
Wrap
Text File
|
1994-07-12
|
1KB
|
32 lines
Newsgroups: alt.sources
Path: wupost!howland.reston.ans.net!agate!boulder!csn!server!sanitas!pg
From: pg@sanitas.stortek.com (Paul Gilmartin)
Subject: Re: Source to a simple which command (C program source)
Message-ID: <CsqHA5.6HE@stortek.com>
Sender: usenet@stortek.com
Nntp-Posting-Host: sanitas.stortek.com
Organization: Storage Technology Corporation
X-Newsreader: TIN [version 1.2 PL2]
References: <1994Jul8.104300.16682@walter.cray.com> <1994Jul10.004128.25426@vigard.mef.org>
Date: Sun, 10 Jul 1994 16:46:53 GMT
Lines: 18
Matthew Francey (mdf@vigard.mef.org) wrote:
: jwl@dogwood.cray.com (James W. Lynch) writes:
: >I noticed a discussion recently that suggested that everyone didn't
: >have a which command.
: IFS=" \011\012:"
^^^^^^^^
Hmmm. This appears to work in ksh, but not in bash or sh. But if you
have ksh, you have the "whence" command, which is about the same as
"which". So why bother?
: for i in $*; do
: for j in $PATH; do
: [ -x $j/$i ] && { echo $j/$i; break; }
: done
: done
-- gil