Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect output of command with heredoc

I have a command like this:

sftp user@host <<EOF
put file.txt
exit
EOF

Now I'd like to pipe the output of that to zenity --progress, but I can't find a place to put it.

# 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 
like image 667
Bart van Heukelom Avatar asked Dec 21 '22 20:12

Bart van Heukelom


1 Answers

This should do the trick:

sftp user@host <<EOF | zenity --progress
...
EOF
like image 166
choroba Avatar answered Dec 31 '22 15:12

choroba