Im trying to create a script to archive specified directories into a specified tarball backup file. This is what i want the input to look like
ex. save -i '/bin/b*' -i '/bin/ls' -o backup
this is what i have
#!/bin/bash
#save - backup file script
unset myInput
unset myOutput
while getopts "i: o:" myOpt
do
if [ $myOpt == "i" ]
then
myInput=$myInput" "$OPTARG
elif [ $myOpt == "o" ]
then
myOutput=$OPTARG
fi
done
echo "[Backing up $myInput to $myOutput]"
if test -f $myOutput
then
echo "$myOutput already exists: must rename"
fi
echo "Input file list: "
for file in $myInput
do
ls -laR "$file"
done