On this page
article
Bash
Check if variable is set
source: where ${var+x} is a parameter expansion which evaluates to nothing if var is unset, and substitutes the string x otherwise.
if [ -z ${var+x} ]; then echo "var is unset"; else echo "var is set to '$var'"; fi
Looping shell with ssh
This requires using -n because ssh otherwise will consume the while loop
while read i; do
echo $i; ssh -n $i "echo $(whoami)";
done < /servers
Run a command with a specific UID
Whether that user exists or not. Great for permission issues. Source
sudo -u '#1234' vi file