Why does this simple bash code give a syntax error? -
I have the following bad code, which has been copied and pasted from "Basque cookbook" (1 version):
#! / Bin / bash VERBOSE = 0; If [[$ 1 = -v]] veerbose = 1; Shift; FI
When I run it (bash 4.0.33), I get the following syntax error:
./ test.sh: line 4: Conditional binary operator expected ./test.sh: line 4: syntax error with `= -v './test.sh: line 4:` If [[$ 1 = -v]]' '
Is this simple as a wrong impression in the Bash cookbook, or is there any version incompatibility or is there something else? What will be most obvious? I have tried different combinations of changing operators, but I am not really familiar with Bash scripting.
Uses spaces to bash the scripts line:
Should be [[$ 1 = -v]]
:
if [[$ 1 = -V]]
Comments
Post a Comment