redirection

Bash allocate named descriptor

Bash allocates an available descriptor at least 10 and stores its number in fd. Use exec for explicit lifetime management and close it when done.

Formal Syntax & Structure

bash syntaxbash
{fd}>file

Return Value

redirection effect

Bash allocates an available descriptor at least 10 and stores its number in fd. Use exec for explicit lifetime management and close it when done.

Working Example

Example Snippetbash
exec {fd}> records.txtprintf 'alpha\n' >&"$fd"printf 'beta\n' >&"$fd"exec {fd}>&-cat records.txt
Bash Reference