I am using a remot server running Ubuntu 13.10 with Bash 4.2.45 installed. My home system is OS X Mavericks with Bash 3.2.51 (Darwin build) installed. I haven't used bash much in the past but I've been working on a pretty big script and noticed a few things that were weird about the version installed on the remote server.
Take a simple script for example:
#!/bin/sh
read n
if ((n > 10)); then
echo "Number is pretty big"
else
echo "NUMBER IS WEAK AND SMALL"
fi
While under bash 3.2.51 it recognizes the expression and works under the bash 4 on Ubuntu it throws a weird error:
script.sh: 5: script.sh: n: not found
But not only are (( . . . )) not recognized but sometimes variables and other logical statements. As a bash beginner it's very confusing and I wanted to ask what I could do about that. Can I change the syntax rules? Or just downgrade the remote server to a 3.x.y version? Any help is appreciated.