commit dae1a5aaa09c094b211f496c8d324b97764d280b
parent 28c321720866059ac126f524fd1102f3ea510772
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Mon, 3 Jun 2019 08:43:26 +0200
Improve invalid file handling in shdl
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.local/bin/shdl b/.local/bin/shdl
@@ -70,7 +70,7 @@ shdl_fetch() {
echo "saved to $file"
if [ ! -f "$file" ] || [ "$(file "$file" | cut -d' ' -f2)" = "HTML" ]; then
(echo "Error: downloaded file $file is not valid. Opening browser..." >&2)
- rm "$file"
+ [ -f "$file" ] && rm "$file"
browser_open "$shurl"
elif [ "$open" = 1 ]; then
xdg-open "$file"