diff options
author | Abel `00z' Camarillo <00z@the00z.org> | 2009-06-28 02:42:31 -0500 |
---|---|---|
committer | Abel `00z' Camarillo <00z@the00z.org> | 2009-06-28 02:42:31 -0500 |
commit | d36686924a2b7d81ad5c74b38249e53af0b6449e (patch) | |
tree | 3d1b7b5e183aa8547be6c073a9fc8717d13d0174 /examples | |
parent | 865abce98298fb1865b818b88cfc4fb1027c1868 (diff) |
make domnload.sh more portable
now not bash-specific.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/data/uzbl/scripts/download.sh | 20 |
1 files changed, 12 insertions, 8 deletions
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 |