#!/bin/bash
#define globals
D=`date '+%B %d %j'`
if [ "$1" == "m" ]
then
m=1
elif [ "$1" == "p" ]
then
p=1
elif [ "$1" == "d" ]
then
d=1
elif [ "$1" == "g" ]
then
comp="z"
elif [ "$1" == "b" ]
then
comp="j"
elif [ "$1" == "adv" ]
then
echo "Enter in the dir's / files you would like to archive - NOTE: Files
will be indexed into a file called $HOME/.INDEXED_FILES for future
use.";
echo "If you would like to use a prev. index, use the command option
'<command> pre' -- This can be very useful for cron daemons!";
echo ""
while [ "${files[$x]}" != "DONE" ]
do
((x=x+1))
read temp
files[$x]=$temp;
done
echo "Files to archive: "
b=$x
x=1
while [ $x != $b ]
do
echo "${files[$x]}"
((x=x+1))
done
echo "What type of compression ((g)zip (b)zip2 or (n)one?"
read comp
x=1
while [ $x != $b ]
do
temp=${files[$x]%%.*}
read toarch="${toarch} ${temp}"
((x=x+1))
done
echo $toarch
##tar -cvf$comp backup-$D.zb
echo $toarch
elif [ "$1" == "pre" ]
then
pre=1
else
echo "USAGE:"
echo "<command> <option1><SPACE><option2><SPACE><option3>";
echo ""
echo "COMPRESSION OPTIONS:";
echo "b (bzip2) , g (gzip) ; n (none)";
echo ""
echo "CONTENT OPTIONS:"
echo "m (music(mp3,wma,ogg) "
echo "d (documents(doc,txt,pdf,html,ppt,xml,xls))"
echo "p (pictures(jpg,bmp,gif,png))";
echo ""
echo "use <command> adv for advanced backup mode:::manually select which files to
archive!";
fi
if [ "$2" == "m" ]
then
m=1
elif [ "$2" == "p" ]
then
p=1
elif [ "$2" == "d" ]
then
d=1
elif [ "$2" == "g" ]
then
comp="z"
elif [ "$2" == "b" ]
then
comp="j"
elif [ "$2" == "adv" ]
then
echo "Enter in the dir's / files you would like to archive - NOTE: Files
will be indexed into a file called $HOME/.INDEXED_FILES for future
use.";
echo "If you would like to use a prev. index, use the command option
'<command> pre' -- This can be very useful for cron daemons!";
fi
if [ "$3" == "m" ]
then
m=1
elif [ "$3" == "p" ]
then
p=1
elif [ "$3" == "d" ]
then
d=1
elif [ "$3" == "g" ]
then
comp="z"
elif [ "$3" == "b" ]
then
comp="j"
elif [ "$3" == "adv" ]
then
echo "Enter in the dir's / files you would like to archive - NOTE: Files
will be indexed into a file called $HOME/.INDEXED_FILES for future
use.";
echo "If you would like to use a prev. index, use the command option
'<command> pre' -- This can be very useful for cron daemons!";
fi
if [ "$4" == "m" ]
then
m=1
elif [ "$4" == "p" ]
then
p=1
elif [ "$4" == "d" ]
then
d=1
elif [ "$4" == "g" ]
then
comp="z"
elif [ "$4" == "b" ]
then
comp="j"
elif [ "$4" == "adv" ]
then
echo "Enter in the dir's / files you would like to archive - NOTE: Files
will be indexed into a file called $HOME/.INDEXED_FILES for future
use.";
echo "If you would like to use a prev. index, use the command option
'<command> pre' -- This can be very useful for cron daemons!";
fi
if [ "$5" == "m" ]
then
m=1
elif [ "$5" == "p" ]
then
p=1
elif [ "$5" == "d" ]
then
d=1
elif [ "$5" == "g" ]
then
comp="z"
elif [ "$5" == "b" ]
then
comp="j"
elif [ "$5" == "adv" ]
then
echo "Enter in the dir's / files you would like to archive - NOTE: Files
will be indexed into a file called $HOME/.INDEXED_FILES for future
use.";
echo "If you would like to use a prev. index, use the command option
'<command> pre' -- This can be very useful for cron daemons!";
fi
if [ "$6" == "m" ]
then
m=1
elif [ "$6" == "p" ]
then
p=1
elif [ "$6" == "d" ]
then
d=1
elif [ "$6" == "g" ]
then
comp="z"
elif [ "$6" == "b" ]
then
comp="j"
elif [ "$6" == "adv" ]
then
echo "Enter in the dir's / files you would like to archive; enter in
DONE when finished - NOTE: Files
will be indexed into a file called $HOME/.INDEXED_FILES for future
use.";
echo "If you would like to use a prev. index, use the command option
'<command> pre' -- This can be very useful for cron daemons!";
echo ""
fi