There are a few different references to 'input' here, so I will give a few scenarios with understanding it in mind first. For your quick answer to the question in shortest form:
stat testfile < <($1)> outputfile
The above will perform a stat on testfile, take (redirect) it's STDOUT and include that into the next special function (the <() part) then output the final results of whatever that was, into a new file (outputfile). The file is called, then referenced with bash built-ins ($1 each time after, until you begin a new set of instructions).
Your question is great, and there are several answers and ways to do this, but it does indeed change with what you are doing specifically.
For instance, you can loop that as well, which is quite handy. A common usage of this is, in psuedo-code mindset, is:
run program < <($output_from_program)> my_own.log
Taking that in and expanding on that knowledge allows you to create things such as:
ls -A; (while read line; do printf "\e[1;31mFound a file\e[0m: $line\n"; done) < <(/bin/grep thatword * | /usr/bin/tee -a files_that_matched_thatword)
This will perform a simple ls -A on your current directory, then tell while to loop through each result from the ls -A to (and here's where it's tricky!) grep "thatword" in each of those results, and only perform the previous printf (in red) if it actually found a file with "thatword" in it. It will also log the results of the grep into a new text file, files_that_matched_thatword.
Example output:
ls -A; (while read line; do printf "\e[1;31mFound a file\e[0m: $line\n"; done) < <(/bin/grep thatword * | /usr/bin/tee -a files_that_matched_thatword)
index.html
All of that simply printed the ls -A result, nothing special. Add something for it to grep this time:
echo "thatword" >> newfile
Now re-run it:
ls -A; (while read line; do printf "\e[1;31mFound a file\e[0m: $line\n"; done) < <(/bin/grep thatword * | /usr/bin/tee -a files_that_matched_thatword)
files_that_matched_thatword index.html newfile
Found a file: newfile:thatword
While perhaps a more exhausting answer than you're looking for at present, I believe keeping handy notes like this around will benefit you much more in future endeavours.
<
(input from file to the left side) or|
(input from stream to the right side). There's a difference.yank-last-arg
command (default shortcutMeta-.
orMeta-_
;Meta
often being the leftAlt
key) will copy the last parameter from the preceding command line into the current one. So, after executingstat fileName
you typefile [Meta-.]
and do not have to type thatfileName
again. I always use that.<
and>
are redirection, not piping. A pipeline connects two processes, while redirection simply reassigns stdin/stdout.