0
I'm new to bash scripting, and I'm trying to learn on Windows, so I downloaded cygwin. Using Windows 10, cygwin v2.5.1
I made sure I installed the bash package (I did), and so I started going through some tutorials, but when I reached if...fi
statements, it stopped working. Here's my code:
#!/usr/bin/env bash
#
echo 'Hello'
#
if [ 1 -eq 1 ]
then
echo 'Success'
fi
echo 'Hello Again'
The output is
>./test.sh
Hello
./test.sh: line 10: syntax error: unexpected end of file
I can't for the life of me figure out what's going wrong. I've copy/pasted if statements and tried different types of expressions, but it doesn't seem to register the if
at all.
Maybe I configured cygwin wrong?
Missing semi-colon maybe? Try "if [ ... ]; then". Note the semi-colon after the square brackets. – jehad – 2016-06-21T22:49:46.770
Also, I know the multi-statement semi-colon is just stylistic, but maybe something in cygwin version needs it!? Don't know, not really a Windows guy. :) – jehad – 2016-06-21T22:53:47.830