Updated to better deal with parameters

This commit is contained in:
Jeroen De Meerleer 2018-12-05 15:42:44 +01:00
parent 493cb40ffd
commit 8cee47f8d9
1 changed files with 4 additions and 8 deletions

View File

@ -61,10 +61,6 @@ GetOptions() {
OPTIONS=s:d:t:cav::h OPTIONS=s:d:t:cav::h
LONGOPTS=source:,dest:,temp:,convert,convert-art,verbose::,help LONGOPTS=source:,dest:,temp:,convert,convert-art,verbose::,help
# Parsing style without -s or -d
source=${*: -2:1}
dest=${*: -1:1}
# -use ! and PIPESTATUS to get exit code with errexit set # -use ! and PIPESTATUS to get exit code with errexit set
# -temporarily store output to be able to check for errors # -temporarily store output to be able to check for errors
# -activate quoting/enhanced mode (e.g. by writing out “--options”) # -activate quoting/enhanced mode (e.g. by writing out “--options”)
@ -126,12 +122,12 @@ GetOptions() {
esac esac
done done
if [[ ! -z ${1+x} ]]; then if [[ ! -z "${1}" ]]; then
source=$1 source="$1"
fi fi
if [[ ! -z ${2+x} ]]; then if [[ ! -z "${2}" ]]; then
dest=$2 dest="$2"
fi fi
if [[ $dest == "-" ]] || [[ $source == "-" ]]; then if [[ $dest == "-" ]] || [[ $source == "-" ]]; then