The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 05-23-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,790
By default stdin, stdout, and stderr are file descriptors opened during process creation.
If the file limit is 16, for example, then the process has 13 files descriptors to play with.

In shell scripts, redirection uses up file descriptors. Once the line "doing" the redirection has been completed the file descriptor is closed ie: ls * > myfile.txt. Redirecting blocks of code, like a loop, use up a file descriptor over many lines of code.

Code:
for file in `ls /path`
do
     cat $file
done > myfiles.txt

Cron jobs run without a tty, stdin is the script.