fetch: use a slightly more correct check for TTY stdin

This commit is contained in:
Lucas 2020-05-03 13:53:19 +00:00
parent 06f9918f2c
commit 17ef04b41a

View File

@ -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