From 8cee47f8d982342567050c72bd9a474098dad1b3 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Wed, 5 Dec 2018 15:42:44 +0100 Subject: [PATCH] Updated to better deal with parameters --- music-sync.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/music-sync.sh b/music-sync.sh index 5b281ac..75f649c 100755 --- a/music-sync.sh +++ b/music-sync.sh @@ -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