使用heredoc重定向命令输出

Bar*_*lom 3 bash heredoc zenity

我有这样的命令:

sftp user@host <<EOF
put file.txt
exit
EOF
Run Code Online (Sandbox Code Playgroud)

现在我想把它的输出管道输出zenity --progress,但我找不到放置它的地方.

# SFTP doesn't work anymore
sftp user@host | zenity --progress <<EOF
put file.txt
exit
EOF

# Invalid syntax, no end of heredoc
sftp user@host <<EOF
put file.txt
exit
EOF | zenity --progress

# Not picked as part of the command
sftp user@host <<EOF
put file.txt
exit
EOF
| zenity --progress

# Does not help
sftp user@host | zenity --progress <<EOF
put file.txt
exit
EOF\
| zenity --progress 
Run Code Online (Sandbox Code Playgroud)

cho*_*oba 10

这应该做的伎俩:

sftp user@host <<EOF | zenity --progress
...
EOF
Run Code Online (Sandbox Code Playgroud)