Friday, October 9, 2009

Linux - Bash Shell Scripting - A Simple Backup Script

This script will tar and compress the files in the specified directory which is located beneath the current directory,

#!/bin/bash
# usage: bu dir
tar cvf $1.tar $1a
bzip2 $1.tar
mv $1.tar.bz2 mybackups
echo "$1 backed up."
$ bu src
src backed up.
$ ls mybackups
src.tar.bz2

No comments:

Post a Comment