Filehandles

Filehandles are symbolic IDs for files and pseudo-files that are set up each time the kernel starts a process. These numbers are what the process uses to write output and read input. Three filehandles are opened by default:

FilehandleMeaning
F.H. 0STDIN. This is where standard input comes from. This is normally the keyboard, but it can be redirected to read from a file or some other source.
F.H. 1STDOUT. This where standard output goes. It is normally the screen, but as you have seen it can be redirected.
F.H. 2STDERR. This is where standard error messages go. Once again, this is normally the screen, but it can also be redirected.

Filehandles can be used in shell programs to make your programs both more efficient and easier to write. ...

Get FreeBSD6 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.