From 7650685b085cdf7dbcde64458f371dcf10ae9138 Mon Sep 17 00:00:00 2001 From: gutmet Date: Tue, 3 Nov 2020 12:35:38 +0100 Subject: [PATCH] make par command idempotent if possible --- youtube-par-cmd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/youtube-par-cmd b/youtube-par-cmd index 1c5e5c5..bfb34bd 100755 --- a/youtube-par-cmd +++ b/youtube-par-cmd @@ -13,8 +13,12 @@ playlistInfo="$playlistTitle" output="$(mkdir "$playlistTitle")" status=$? if [ $status -ne 0 ]; then - playlistTitle=`echo "$playlistJSON" | jq -r '.id'` - mkdir "$playlistTitle" + output="$(cd "$playlistTitle")" + status=$? + if [ $status -ne 0 ]; then + playlistTitle=`echo "$playlistJSON" | jq -r '.id'` + mkdir "$playlistTitle" + fi fi cd "$playlistTitle"