8 months ago
15 lines376 B
#!/bin/sh | |
# Back up a folder with today's date in the name | |
src="$HOME/notes" | |
dest="$HOME/backups/notes-$(date +%F).tar.gz" | |
| |
if [ ! -d "$src" ]; then | |
echo "Nothing to back up: $src is missing" >&2 | |
exit 1 | |
fi | |
mkdir -p "$HOME/backups" | |
tar -czf "$dest" "$src" && echo "Saved $dest" | |
| |
# This is the version we use in the video. | |
| |
# See the lesson README for what to try next. |