I need to implement something like:
if [ $i -ne $hosts_count - 1] ; then
cmd="$cmd;"
fi
But I get
./installer.sh: line 124: [: missing `]'
What I am doing wrong?
] must be a separate argument to [.You're assuming you can do math in [.
if [ $i -ne $(($hosts_count - 1)) ] ; then
[[ will let you have unquoted empty variables without causing problems.