david/sshbackup
david
/
sshbackup
Archived
1
0
Fork 0

more work on the option handler

This commit is contained in:
david 2013-04-25 23:30:44 +02:00
parent 3f6bb94542
commit 42b374cb4f
1 changed files with 12 additions and 5 deletions

View File

@ -43,13 +43,14 @@ usage()
{
echo
echo "usage: sshbackup <options> [[user@]server:]/source/path /destination/path [versions]"
echo "usage: sshbackup <options> source destination [versions]"
echo "source/destination example: [[user@]server:]/path/to/files"
echo
echo "OPTIONS:"
echo " -h, --help show this message"
echo " -v, --version show version information"
echo " -v, --version version information"
echo " -c, --config <config file> alternate config file"
echo " -s, --sshkey <sshkeyfile> use alternate sshkeyfile"
echo " -s, --sshkey <sshkeyfile> alternate sshkeyfile"
echo
}
@ -135,6 +136,7 @@ for option in $options; do
else
if [[ $option =~ ^-.* ]]; then
echo "aborting mission. unknown option given. [$option]"
usage
exit 1
#TODO: what if source or dest is a number?
elif [ -z "${option//[0-9]/}" ]; then
@ -159,13 +161,18 @@ if [ -z $sourcepath ]; then
echo "aborting mission. no source path given."
exit 1
elif [ -z $destinationpath ]; then
destinationpath="."
#destinationpath="."
echo "aborting mission. no destination path given."
exit 1
fi
source $configfile
if [ -r $configfile ]; then
source $configfile
fi
#running preflight checks
preflight
#sshbackup $sourcepath $destinationpath $versions