How do I play with test command properly?

Posted by httpinterpret on Stack Overflow See other posts from Stack Overflow or by httpinterpret
Published on 2010-05-29T04:21:22Z Indexed on 2010/05/29 4:32 UTC
Read the original article Hit count: 135

Filed under:
|
[root@jiaoyou ~]# test 1 = 1 -a 0 = 1
[root@jiaoyou ~]# if [1 = 1 -a 0 = 1]then echo 1;else echo 2;fi
-bash: syntax error near unexpected token `else'

Why test doesn't give any output and the if statement fails?

Can someone point out what's wrong here?

© Stack Overflow or respective owner

Related posts about linux

Related posts about bash