|
They are other integers that relate to files. Some programs are too complex to fit into a stdin/stdout model. Some scripts simply need more stuff as well. A contrived example:
exec 3> john.out
exec 4>paul.out
exec 5>george.out
exec 6>ringo.out
echo harrison >&5
echo lennon >&3
With these echo statements, something like >&3 really means 1>&3 which means send fd 1 into whatever fd 3 is pointing to. Nobody actually writes to 3 in this case. 3 is kind of a placeholder. With the korn shell, you can do
print -u6 starr
where the -u6 says to actually use fd 6. And you might write a c program with statements like:
write(4, "mccartney", 10);
With a program like that, you may need to connect something to fd 4 if the program itself doesn't do it.
|