[Ubuntu] Process substitution prints out file descriptor?
Every time I use process substitution, it prints out the file descriptor of the temporary pipe afterwards. Simplest example (I wouldn't expect any output):
Code:
$ echo <( false ) |
Try cat instead of echo. Do you literally=actually get that > character displayed on the output=result line? (I don't)
Now that I've knocked this thread off of pristene ZRT status, hopefully LQgurus will come along with a detailed explanation;) A web-search of "/dev/fd/63" returns somethings I remember searching for in the past, like: https://unix.stackexchange.com/quest...hich-is-a-pipe Edit: Found MUCH BETTER! link: http://tldp.org/LDP/abs/html/process-sub.html And, adding ThreadTitle, http://wiki.bash-hackers.org/syntax/...ion/proc_subst Wiki has echo<(true) http://wikipedia.org/wiki/Process_substitution But I don't have a precise&full explanation. (Interesting study tho!) p.s. Minor 'nit': suggest adding "bash" to ThreadTitle (so viewers don't think 'krnl' e.g. ;) ) |
Quote:
If you want to redirect a command's stdin as with a pipe, you can do it this way: Code:
command1 < <( command2 ) I'm sure some will wonder why on Earth you would do that rather than simply writing "command2 | command1", but that construct is useful for streams other than stdin and for redirecting the stdin of loops in shell scripts: Code:
X=0 |
Yep, I'm stupid. The actual program I had trouble with was wc (to be exact: "wc -l <( find /home/me -size -2k )" ). Then to make a minimum replication of the problem, I used echo. Echo will just print out the argument it gets, and wc will print out the file(s) it counted in at the end.
|
All times are GMT -5. The time now is 10:13 AM. |