Consider having the results from the pipe:
find .
Now I would like to access in the second command behind the pipe what is actually piped (inpu
Short answer: You can print each file twice using sed:
find . | sed 's/.*/& &/'
Sed can edit lines as they are inputted. The above command says s
(substitute) .*
(the entire line) & &
(with itself, twice).
Longer answer: When you pipe one program into another, you're connecting the first program's standard output stream to the second program's standard input stream. Anything the first program prints will be treated as input for the second program.
Unfortunately for your example, the input doesn't come in line-by-line chunks that map nicely to a hypothetical $args
variable. It comes in a big monolithic stream. If you want to print each line of the stream twice, you can use sed (which is a Stream EDitor), but it's just doing line-by-line replacements.