Search This Blog

Monday, February 21, 2011

[: missing `]' +bash +shell scripts

 "=" sign requires a blank in front of it and after it. Otherwise, the bash only sees "something" within the brackets, and that is true (0), while "nothing" is false (1):

ex.
[ 5 = 6]
 
solution 
[ 5 = 6 ] 
 
 
Tutorials:
http://wiki.linuxquestions.org/wiki/Bash_tips
http://www.tldp.org/LDP/abs/html/
https://wiki.archlinux.org/index.php/Color_Bash_Prompt 

5 comments:

Anonymous said...

Thanks , Helped me alot with my syntax!

Anonymous said...

You just saved me

Anonymous said...

Awesome, thanks!

Dama murali krishna said...

thanks a lot, u saved my time

Caterina said...

God! I have been browsing whole StackOverflow with no luck and YOU had the answer

Thanks a million! :)