From da99fd2ad408c54b1165981440e59901263d599c Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Sun, 20 Jun 2021 12:07:39 +0200 Subject: [PATCH] editing URLFILE more reliable --- threadwatcher | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/threadwatcher b/threadwatcher index 26cdfcc..9e0c671 100755 --- a/threadwatcher +++ b/threadwatcher @@ -121,7 +121,6 @@ scan(){ } add() { - dl_location="$(makepathabsolute "$2")" if grep -qP "^$1\t" "$URLFILE"; then dl_location_already="$(grep -P "^$1\t" "$URLFILE" | cut -f2)" @@ -175,7 +174,6 @@ add() { printf "%s\t%s\n" "$1" "$dl_location" | tee -ai "$URLFILE" echo "added $1 to threadwatcher list. Downloading to $dl_location" fi - echo "dl_location:$dl_location" } case "$1" in @@ -197,7 +195,9 @@ case "$1" in rm "$URLFILE" touch "$URLFILE";; - "edit") ${EDITOR:-vim} "$URLFILE";; + "edit") #kill all other threadwatcher instances sine they could want to change $URLFILE + pgrep threadwatcher | grep -v "^$$$" | xargs -r kill + ${EDITOR:-vim} "$URLFILE";; "help") echo "$help";; *)echo "Incorrect usage. Correct usage:" echo "$help" && exit 1;;