Is there a way that stdin can 'hop' over a process? For example, in the following command,
cat file | ssh host 'mkdir -p /some/directory && cat > /some/directory/file'
This will send the stdin from the first
mkdir and the second
cat will recieve no stdin. I want the stdout from the first
cat to hop over
mkdir and only be sent to the second
cat. I am aware that you can run something like:
cat file | ssh host 'cat > /tmp/file2 ; mkdir -p /some/directory && mv /tmp/file2 /some/directory/'
That only works when copying a file or
cat file | ssh host 'tee >(mkdir -p /some/directory) >/some/directory/file'
But that only works because the
mkdir command does not use stdin. Is there a command that will execute a command that replicates this functionality? Something like:
cat file | ssh host 'stdinhop mkdir -p /some/directory | cat > /some/directory/file'
stdinhop would not send its stdin to mkdir, but it redirect it to stdout so the second cat can read it?