rsync: specify SSH identity file (private key)








rsync -Pavx -e 'ssh -i /path/to/id_rsa' /local/file user@server:/remote/dir



Bash: check if number is odd or even








n=12
if [[ $((n % 2)) -eq 0 ]]; then
   echo "even"
else
   echo "odd"
fi



Bash: loop through file names with spaces








#!/bin/bash

IFS_BAK=$IFS
IFS=$(echo -en "\n\b")
for f in $(ls)
do
  echo "$f"
done
IFS=$IFS_BAK