print usage when less than two arguments are provided

This commit is contained in:
Michael Krayer 2021-03-25 17:23:38 +01:00
parent 92e72f91d4
commit b6568cf471
1 changed files with 6 additions and 0 deletions

6
icp
View File

@ -50,6 +50,12 @@ do
fi
done
# Check if we got any actual arguments
if [[ ${#rsync_arg[@]} -lt 2 ]];then
usage
exit $EXIT_INVALID_PATH
fi
# If last argument (target) is a directory
# add a trailing slash
if [[ -d "${rsync_arg[-1]}" ]];then