On 2007-08-19 21:23:12 -0600, Bob Proulx wrote: > Manon Metten wrote: > > David Brodbeck wrote: > > > It certainly has its warts. In particular, Bash's "test" (aka "[") > > > operator has pitfalls. > > The test command was originally not a shell built-in. It was an > external standalong /bin/test command. For performance reasons it has
I don't think it is for performance reasons. Have you ever seen any noticeable performance gain? > been incorporated into the shell but the interface can't change or it > would break compatibility. Sure: vin:~> bash [EMAIL PROTECTED]:~$ touch exists [EMAIL PROTECTED]:~$ [ ! -a exists ] || echo found [EMAIL PROTECTED]:~$ /usr/bin/[ ! -a exists ] || echo found found [EMAIL PROTECTED]:~$ I think that [ has been added as a builtin to the bash shell in order to add features... that break compatibility! > But better to use the one = so that it is portable. I prefer using an > underscore to hide it more but 'X' is the tradition. > > if [ _"$foo" = _"" ] Are you sure that [ "$foo" = "" ] isn't POSIX sh? IMHO, it is perfectly valid (note: the quotes are important). -- Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/> Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]