20141220

handy script to quickly backup a file

#!/bin/bash
# backup a file (somefile to somefile.yyyy-mm-dd.tar.gz)

FILE="$@"

#debug
echo $FILE

if [ -f $(which tar) ]
then
        tar zcPf "${FILE}".$(date +%s).tar.gz "${FILE}"
else
        echo "sorry, do you have 'tar' installed?"
fi