Linda Walsh wrote: > Am running an older bash version and this may be fixed (assuming it > is a bug and I'm not confused...:-)) > > bash version = 3.2.39(20) > > This works: > 1) if [ -n "" -a 2 -gt 1 ] ; then echo one;fi > > This does not: > 2) if [[ -n "" -a 2 -gt 1 ]] ; then echo one;fi > > > > Shouldn't 2 work equally well as 1? > > (original test on "$1": > -n "$1" -a "$1" -gt 0 > )
I don't know if it should be line that, but it definitely isn't the case. This is also (indirectly) described in the manual: There's a section about "conditional expressions" which holds all the stuff that [ and [[ have in common, then there are individual sections for [[ and test ([) which list &&/|| for [[ and -a/-o for test. http://bash-hackers.org/wiki/doku.php/syntax/ccmd/conditional_expression /----- Do not use the test-typical operators -a and -o for AND and OR, they are not known to the conditional expression. Instead, use the operators && and ||. \----- Ragards, Jan -- This is my life - this is my net! - Jan