Skip to content

Instantly share code, notes, and snippets.

@harushimo
Created December 6, 2012 17:23
Show Gist options
  • Save harushimo/4226277 to your computer and use it in GitHub Desktop.
Save harushimo/4226277 to your computer and use it in GitHub Desktop.
bash script
#!/bin/bash
#Source and Target
source="$HOME/Downloads"
current_date=`date"+%m_%d_%y"`
target="$HOME/backup/${current_date}_back.tar.gz"
#Creating backup.tgz file to back up directory
tar -cvzf "$target" --exclude="$target" "$source"
Error Message
/backup.sh: line 5: date+%m_%d_%y: command not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment