Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

:-(

Status
Not open for further replies.

terminalfrost

Programmer
Oct 11, 2003
3
CA
plz explain me wht is a file descriptor.wht actually its functionality is??
 
A file descriptor is a place holder for an open file and is usually identified by a positive integer. When a process is created it gets three file descriptors by default: 0 (standard input), 1 (standard output) and 2 (standard error).

Any additional files you open will be given file descriptors of 3 and higher.

Annihilannic.
 
For example,
#!/bin/ksh
date > status
df -k >> status

exec 3< status #status redirect to fd3
exec 4> time #fd4 redirect to time

read -u3 line #assign fd3 to variable $line
print -u4 $line #print $line to fd4

#Try to know this by yourself
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top