Nice sed tip to remove extra whitespace at the end of lines in a file.
sed -e 's/ *$//' <file>Tags: sed, whitespace
Ping a host until it answers and then connect. I actually have this in a script that will use the first argument as the host.
while ! ping -W 1 -c 1 <hostname or IP> 2>&1 >/dev/null; do true; done && sleep 15; ssh <user>@<hostname or IP>via The Linux Blog