exec is a built-in Bash function, so it can have special behavior that an external program couldn't have. In particular, it has the special behavior that:
If COMMAND is not specified, any redirections take effect in the current shell.
This applies to any sort of redirection; you can also write, for example, any of these:
exec >tmp.txt
If COMMAND is not specified, any redirections take effect in the current shell.
This applies to any sort of redirection; you can also write, for example, any of these:
exec >tmp.txt
exec >>stdout.log 2>>stderr.log
exec 2>&1
No comments:
Post a Comment