redirection

Bash close output descriptor

Close output descriptor n; with exec the change persists in the current shell.

Formal Syntax & Structure

bash syntaxbash
n>&-

Return Value

redirection effect

Close output descriptor n; with exec the change persists in the current shell.

Working Example

Example Snippetbash
exec 3> log.txtprintf 'ok\n' >&3exec 3>&-cat log.txt
Bash Reference