sh
uses different syntax for operators than bash
.
Use -o
for or in place of ||
and -a
for and in place of &&
.
echo test 2> /dev/null
echo test 2>&1
When checking for string length, include the string in quotes.
Both of these will return true:
[ -n string ] [ -n ]
This will return false:
[ -n "" ]