Re: 'which' script

2006-03-26 Thread Dan Nicholson
On 3/26/06, Alexander E. Patrakov [EMAIL PROTECTED] wrote: Is the piping through 'head' really necessary ? 'type -p' alone seems to do the job ... Indeed, head isn't needed even if the binary is in two places in $PATH. type -pa is in there for the purpose of aliased binaries. For

'which' script

2006-03-25 Thread Lennon Cook
The script mentioned on the 'which' page as an alternative to compiling the binary has a minor problem, in that if one tries to 'which foo' (where foo doesn't exist), the exit status of which is 0, even though the exit status of type is 1. This can be fixed by adding a line to the script, thus:

Re: 'which' script

2006-03-25 Thread Jeremy Huntwork
Lennon Cook wrote: type -pa $@ | head -n1 exit $PIPESTATUS The problem is that without this extra line, the script will exit with the exit status of 'head'. I thought we decided to get rid of the pipe to head? Didn't we establish that type -p or type -path is sufficient? -- JH --

which script

2005-11-17 Thread Jeremy Huntwork
Hi Guys: I have a question. The which script provided as an alternative to Gnu Which uses the syntax: type -pa | head -n 1 ... My question is, why do we pipe it through head so we can choose only the first occurence when 'type -path' does the same thing? If it's a portability thing

Re: which script

2005-11-17 Thread Tushar Teredesai
On 11/17/05, Jeremy Huntwork [EMAIL PROTECTED] wrote: I have a question. The which script provided as an alternative to Gnu Which uses the syntax: type -pa | head -n 1 ... type -p has problems if the command is aliased to something. -- Tushar Teredesai mailto:[EMAIL PROTECTED] http

Re: which script

2005-11-17 Thread Jeremy Huntwork
Tushar Teredesai wrote: type -p has problems if the command is aliased to something. OK, thanks for the tip. Is that a common occurence? -- JH -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information

Re: which script

2005-11-17 Thread silverspurg
Thanks for the read. Quite interesting. :) -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page