I wonder how to create a pipe
program 1 | ... | program N
where multiple of the programs ask for user input. The problem is that |
starts the programs in parallel and thus they start reading from the terminal in parallel.
For such cases it would be useful to have a pipe |
that starts program (i+1) only after program i has produced some output.
Edit:
Example:
cat /dev/sda | bzip2 | gpg -c | ssh user@host 'cat > backup'
Here both gpg -c
as well as ssh
ask for a password.
A workaround for this particular example would be the creation of ssh key pairs, but this is not possible on every system, and I was wondering whether there is a general solution. Also gpg allows for the passphrase to be passed as command line argument, but this is not suggested for security reasons.