Richard Lee over at VA Software brought this up to me today. He said that the Solaris 'which' command does not return the correct error code upon failure. Because of this he has to end up parsing stdout when he should be able to simply rely on the exit code.
Example:
# uname -a
SunOS sol10 5.10 s10_55 sun4u sparc SUNW,Sun-Blade-1500
# which ls
/usr/bin/ls
# echo $?
0
# which oogabooga
no oogabooga in /usr/sbin /usr/bin
# echo $?
0
As Richard would say, "Dirty".
Example:
# uname -a
SunOS sol10 5.10 s10_55 sun4u sparc SUNW,Sun-Blade-1500
# which ls
/usr/bin/ls
# echo $?
0
# which oogabooga
no oogabooga in /usr/sbin /usr/bin
# echo $?
0
As Richard would say, "Dirty".

Posted by Stephen Hahn on June 10, 2004 at 11:31 PM PDT #
Posted by Michael Davey on June 11, 2004 at 02:50 PM PDT #
Posted by Keith Bierman on June 11, 2004 at 06:53 PM PDT #