Josef Ridky <[email protected]> writes:
> + --local=*)
> + temp_name=${1#--local=}
> + if [ "$temp_name" != "" ] && [ "$temp_name" != "$REMOTE_NAME" ]
> && [ "$temp_name" != "$BASE_NAME" ] && [ "$temp_name" != "$BACKUP_NAME" ]
> + then
> + LOCAL_NAME=$temp_name
> + fi
It is not a good idea to ignore an explicit user request without
giving any indication and without giving any explanation.
You may have noticed that we do not say "[ cond ]" in this shell
script (we say "test" instead; see Documentation/CodingGuidelines).
Instead of having such a test all over the place, I'd suggest doing
it outside the loop:
while test $# != 0
do
case "$1" in
...
--local=*)
LOCAL_NAME=${1#--local=} ;;
--remote=*)
REMOTE_NAME=${1#--local=} ;;
...
esac
done
# sanity check _after_ parsing the command line
case ",$LOCAL_NAME,$REMOTE_NAME,$BASE_NAME,$BACKUP_NAME," in
*,,*) die "You cannot set --local/remote/... to empty" ;;
esac
... similarly, duplicate check comes here ...