dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 021e61c512532b6f0bde1777d79ebc01be715071
parent cec08b9e5e29a2b5b1103d89390f456349cac234
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 24 Apr 2019 12:56:50 +0200

Check if downloaded file is HTML

Diffstat:
Mbin/shdl | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bin/shdl b/bin/shdl @@ -68,7 +68,12 @@ function shdl_fetch { browser_open "$shurl" else echo "saved to $file" - [ "$open" = 1 ] && xdg-open "$file" + if [ "$(file "$file" | cut -d' ' -f2)" = "HTML" ]; then + (echo "Error: downloaded file $file is HTML. Opening browser..." >&2) + browser_open "$shurl" + elif [ "$open" = 1 ]; then + xdg-open "$file" + fi fi }