Just editing a bash script and the last line is:
exec <&-
Hoping someone can explain. I'm guessing it has to do with the exit code of the previous command?
Just editing a bash script and the last line is:
exec <&-
Hoping someone can explain. I'm guessing it has to do with the exit code of the previous command?
exec <&- closes standard input (filedescriptor 0).
exec with just redirections but not other argument applies the redirections to the current process.
A redirection to or from &- means close.
With numerical descriptors it doesn't matter if you do 0<&- or 0>&- — either version will close filedescriptor 0 (standard input). If you ommit the number > redirection means "use fildescriptor 1and<` means "use filedescriptor 0".