What does the shell command
exec 5>>foobar.txt
do? I can't google it for obvious reasons, and otherwise not sure where to start looking.
What does the shell command
exec 5>>foobar.txt
do? I can't google it for obvious reasons, and otherwise not sure where to start looking.
As others have said, it opens a file descriptor to append to the named file.
You would use this file descriptor like this:
echo "hello world" >&5
date >&5
while read line; do some_transformation; done < input_file >&5
The command in question redirects file descriptor 5
to a file foobar.txt
.
As for "where to start looking" - this answer is a very good starting point.
5
appended to a file named foobar.txt
in the current directory. Any program waiting for completion of the shell will wait for the new shell and receive its eventual exit status.