aa1ca0987cb434841d8d75ffd75ba29d2b0fdd0d
[uzbl-mobile] / examples / data / uzbl / scripts / download.sh
1 #!/bin/sh
2 # just an example of how you could handle your downloads
3 # try some pattern matching on the uri to determine what we should do
4
5 # Some sites block the default wget --user-agent..
6 GET="wget --user-agent=Firefox"
7
8 dest="$HOME"
9 url="$8"
10
11 test "x$url" = "x" && { echo "you must supply a url! ($url)"; exit 1; }
12
13 # only changes the dir for the $get sub process
14 if echo "$url" | grep -E '.*\.torrent' >/dev/null;
15 then
16     ( cd "$dest"; eval "$GET" "$url")
17 else
18     ( cd "$dest"; eval "$GET" "$url")
19 fi