/dev/fd question
what exactly is going on in this piece of code? what is the role of /dev/fd? i know that /dev/fd/0 is somehow linked to standard input, but that's the extent of my knowledge
Code:
cat header.txt /dev/fd/0 footer.txt |
http://www.informit.com/articles/art...eqNum=15&rll=1
The above link explains /dev/fd. Generally /dev/fd/ has an entry for stdin, stdout, and stderr. stdin is /dev/fd/0. Therefore, your code cats a file called header.txt, followed by stdin, followed by the file footer.txt, one after the other. It is the equivalent to: cat header.txt - footer.txt where the dash in the middle signifies stdin. Sasha |
the explanation in the link is almost exactly the same as the one given in the manual i'm reading. i'm afraid i still don't understand it.
|
ok i think i have the /dev/fd/0 figured out. i have another question, still related to re-direction. what's the difference with:
Code:
exec 7<&0 Code:
exec 7>&0 |
All times are GMT -5. The time now is 08:24 AM. |