Bash Syntax Problem
hey guys, I'm new to scripting and I have a trouble with if statement syntax.
The code is: Code:
#there is a diff command here, and it does what i want but thanks |
Hi,
Spacing is important: if [ "$?" == 0 ] instead of if["$?"==0]. Hope this helps. |
You need spaces between comparison operators and operands.
Also, the semi-colon denotes the end of a statement. You either need the then on the same line or remove the semi-colon. Code:
if ["$?" == 0]; then Code:
if ["$?" == 0] http://tldp.org/LDP/Bash-Beginners-G...ect_07_01.html |
Thank you very much, both of you, it worked.
|
Hi,
This works (remember: s p a c i n g): Code:
if [ "$?" == 0 ] Hope this helps. |
I misunderstand and just use space in the square brackets, but not after if. But it works now, thank you for patience :)
|
You're welcome :)
|
All times are GMT -5. The time now is 11:15 PM. |