From d36686924a2b7d81ad5c74b38249e53af0b6449e Mon Sep 17 00:00:00 2001 From: Abel `00z' Camarillo <00z@the00z.org> Date: Sun, 28 Jun 2009 02:42:31 -0500 Subject: make domnload.sh more portable now not bash-specific. --- examples/data/uzbl/scripts/download.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/data/uzbl/scripts/download.sh b/examples/data/uzbl/scripts/download.sh index d87335f..aa1ca09 100755 --- a/examples/data/uzbl/scripts/download.sh +++ b/examples/data/uzbl/scripts/download.sh @@ -1,15 +1,19 @@ -#!/bin/bash +#!/bin/sh # just an example of how you could handle your downloads # try some pattern matching on the uri to determine what we should do -# Some sites block the default wget --user-agent... -WGET="wget --user-agent=Firefox" +# Some sites block the default wget --user-agent.. +GET="wget --user-agent=Firefox" -if [[ $8 =~ .*(.torrent) ]] +dest="$HOME" +url="$8" + +test "x$url" = "x" && { echo "you must supply a url! ($url)"; exit 1; } + +# only changes the dir for the $get sub process +if echo "$url" | grep -E '.*\.torrent' >/dev/null; then - cd $HOME - $WGET $8 + ( cd "$dest"; eval "$GET" "$url") else - cd $HOME - $WGET $8 + ( cd "$dest"; eval "$GET" "$url") fi -- cgit v1.2.3