editing URLFILE more reliable
This commit is contained in:
parent
3a7c8ea687
commit
da99fd2ad4
@ -121,7 +121,6 @@ scan(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
add() {
|
add() {
|
||||||
|
|
||||||
dl_location="$(makepathabsolute "$2")"
|
dl_location="$(makepathabsolute "$2")"
|
||||||
if grep -qP "^$1\t" "$URLFILE"; then
|
if grep -qP "^$1\t" "$URLFILE"; then
|
||||||
dl_location_already="$(grep -P "^$1\t" "$URLFILE" | cut -f2)"
|
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"
|
printf "%s\t%s\n" "$1" "$dl_location" | tee -ai "$URLFILE"
|
||||||
echo "added $1 to threadwatcher list. Downloading to $dl_location"
|
echo "added $1 to threadwatcher list. Downloading to $dl_location"
|
||||||
fi
|
fi
|
||||||
echo "dl_location:$dl_location"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -197,7 +195,9 @@ case "$1" in
|
|||||||
|
|
||||||
rm "$URLFILE"
|
rm "$URLFILE"
|
||||||
touch "$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";;
|
"help") echo "$help";;
|
||||||
*)echo "Incorrect usage. Correct usage:"
|
*)echo "Incorrect usage. Correct usage:"
|
||||||
echo "$help" && exit 1;;
|
echo "$help" && exit 1;;
|
||||||
|
Loading…
Reference in New Issue
Block a user