diff --git a/bin/fetch.sh b/bin/fetch.sh index 6542972..5f3c159 100644 --- a/bin/fetch.sh +++ b/bin/fetch.sh @@ -1,6 +1,6 @@ #!/bin/sh # fetch -# Written in 2019 by Lucas +# Written in 2019-2020 by Lucas # CC0 1.0 Universal/Public domain - No rights reserved # # To the extent possible under law, the author(s) have dedicated all @@ -12,14 +12,14 @@ usage() { - printf "Usage: %s [-T] URL [URL ...]\n" "${0##*/}">&2 + printf "Usage: %s [-T] URL [URL ...]\n" "${0##*/}" >&2 exit 1 } fetch_cmd() { - if [ -t 0 ]; then - $torsocks ftp "$@" >$(tty) + if tty=$(tty) && [ "$tty" != "not a tty" ]; then + $torsocks ftp "$@" >"$tty" else $torsocks ftp "$@" fi