fetch: explain why we call tty(1)
While at it, also use safe test operands.
This commit is contained in:
parent
fc3171ae5e
commit
68e11fc972
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# fetch
|
||||
# Written in 2019-2021 by Lucas
|
||||
# Written in 2019-2022 by Lucas
|
||||
# CC0 1.0 Universal/Public domain - No rights reserved
|
||||
#
|
||||
# To the extent possible under law, the author(s) have dedicated all
|
||||
@ -18,7 +18,11 @@ usage()
|
||||
|
||||
fetch_cmd()
|
||||
{
|
||||
if tty=$(tty) && [ "$tty" != "not a tty" ]; then
|
||||
# ftp(1) is chatty if stdin is a terminal. It prints its operations to
|
||||
# stdout if "-o output" is used. In that case, we'll need to redirect
|
||||
# stdout to the tty we're being called from, in order to be able to
|
||||
# pipe the output to another command.
|
||||
if tty=$(tty) && [ X"$tty" != X"not a tty" ]; then
|
||||
$torsocks ftp "$@" >"$tty"
|
||||
else
|
||||
$torsocks ftp "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user