[prog] bash: string comparisons in conditionals

Conor Daly c.daly at met.ie
Fri Apr 23 11:47:52 EST 2004

On Fri, Apr 23, 2004 at 01:10:37PM +0200 or thereabouts, Riccarda Cassini wrote:
> Could this have to do with 'test' being a builtin in bash?  I verified
> with strace (my new favorite tool, btw, thanks again Almut :-) that no
> external call to 'test' takes place. So, I assume that bash is handling
> arguments to test/[ internally in a way avoiding any issues with
> leading dashes.

AIUI, test is not a bash builtin;

[cdaly at bofh cdaly]$ which [
[cdaly at bofh cdaly]$ ls -l /usr/bin/[
lrwxrwxrwx    1 root     root            4 Nov  4 11:56 /usr/bin/[ -> test

Since you're calling 'test' as '[', should you be looking for '[' in
strace's output rather than 'test'?  I don't know, just wondering.

Conor Daly,                   Please avoid sending me 
Met Eireann, Glasnevin Hill,  Word or PowerPoint attachments.
Dublin 9, Ireland             http://www.fsf.org/philosophy/no-word-attachments.html
Ph +3531 8064276 Fax +3531 8064247

This e-mail and any files transmitted with it are confidential 
and intended solely for the addressee. If you have received
this email in error please notify the sender.
This e-mail message has also been scanned for the
presence of computer viruses.

More information about the Programming mailing list