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

View File

@ -61,10 +61,6 @@ GetOptions() {
OPTIONS=s:d:t:cav::h
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
# -temporarily store output to be able to check for errors
# -activate quoting/enhanced mode (e.g. by writing out “--options”)
@ -126,12 +122,12 @@ GetOptions() {
esac
done
if [[ ! -z ${1+x} ]]; then
source=$1
if [[ ! -z "${1}" ]]; then
source="$1"
fi
if [[ ! -z ${2+x} ]]; then
dest=$2
if [[ ! -z "${2}" ]]; then
dest="$2"
fi
if [[ $dest == "-" ]] || [[ $source == "-" ]]; then