3

Bash Conditions: "(" versus "["

view full story
linux-howto

http://www.linuxquestions.org – Greetings! I have a question about conditions in Bash scripts. I would like to know the difference between the use of parentheses and square brackets. I have always used square brackets for everything. However, I mistakenly used parentheses in a script on an if statement (old java habit) and it worked great! However, since I'm a perfectionist, I changed the parentheses to square brackets (as I thought that this is the proper syntax) and it broke the script! There is obviously a difference in the way the Bash interpreter handles these metacharacters as they pertain to (HowTos)