Code Sample |
if [ -z $4 ]; then BACKUPNAME="backup.tar.gz" else BACKUPNAME="backup_$4.tar.gz" fi |
Code Sample |
echo -n "${BLUE}Backing up files to ${MAGENTA}$MOUNTPOINT/$BACKUPNAME ${BLUE}mounted on ${MAGENTA}/dev/$DEVICE ${NORMAL}" |
Code Sample |
echo "Usage: filetool.sh {backup|restore [null]|[non-null] device backup_name(changes file name to backup_(backup_name).tar.gz from backup.tar.gz}" |
Code Sample |
sudo filetool.sh backup z hdd4 project01_00 |
Quote |
Also, a space won't work for $2 because an unescaped space is treated as a whitespace. You could try sudo filetool.sh backup \ hdd4 project_$(date +%F) Note, two spaces after \ or sudo filetool.sh backup " " hdd4 project_$(date +%F) |
Code Sample |
if [ -n $5 ]; then if [ -z $4 ]; then BACKUPNAME="backup_$(date +%Y_%m_%d).tar.gz" else BACKUPNAME="backup_$4_$(date +%Y_%m_%d).tar.gz" fi else if [ -z $4 ]; then BACKUPNAME="backup.tar.gz" else BACKUPNAME="backup_$4.tar.gz" fi fi |