Basics
$?
)$?
exit status of last commandecho -e
use double quotation marks ”
or it won’t work.”
“”
to account for spaces in file/dir names\n
in the beginning to give a line break between your response text and the command output||
. This can be used where you are unsure of which OS will be running the command1SERVER_IP=`dig +short myip.opendns.com @resolver1.opendns.com` # External IP of the server
You can put multiple commands on the same line by separating them with a semicolon ;
For example
1if [ “$?” -eq “0” ]; then
2 # do something
3fi
chmod +x foo.sh