Wasted nearly two hours trying to figure out why some simple bash script of mine wasn't working.
#!/bin/sh HOSTNAME=$(hostname) echo HOSTNAME=$HOSTNAME if [ "$HOSTNAME" == "kiffins-laptop" ]; then echo "This is Kiffin's laptop" elif [ "$HOSTNAME" == "georges-laptop" ]; then echo "This is George's laptop" else echo 'Unknown hostname (exit)' exit 1 fi echo "Success" exit 0
Looks perfectly valid to me, so how come when I run the damned script I get the following error messages?
HOSTNAME=laptop [: 11: laptop: unexpected operator [: 11: laptop: unexpected operator Unknown hostname (exit)
Need a hint?