I have error (command not found). so what is the easy solution and explanation for this error?
Asked
Active
Viewed 74 times
-1
Rui F Ribeiro
- 55,929
- 26
- 146
- 227
-
6See [Brackets in if condition: why am I getting syntax errors without whitespace?](http://unix.stackexchange.com/questions/134472/brackets-in-if-condition-why-am-i-getting-syntax-errors-without-whitespace) – steeldriver May 21 '16 at 03:16
1 Answers
0
It looks like you're using a single-brace implementation of test, but missing the whitespace that is required. You probably have something like
echo "Is it morning? Please answer yes or no"
read var
if ["$var" == "yes"]; then
something
else
something else
fi
The problem is that spaces are required inside of the braces, thus:
if [ "$var" == "yes" ]; then
For more details on the syntax, read the manual page for test with the command man test.
DopeGhoti
- 73,792
- 8
- 97
- 133
