redirection

Bash duplicate input descriptor

Duplicate an open input descriptor m onto n (default 0); underlying file offset may be shared.

Formal Syntax & Structure

bash syntaxbash
[n]<&m

Return Value

redirection effect

Duplicate an open input descriptor m onto n (default 0); underlying file offset may be shared.

Working Example

Example Snippetbash
printf 'first\nsecond\n' > input.txtexec 3<input.txtIFS= read -r a 0<&3IFS= read -r b 0<&3exec 3<&-printf '%s %s\n' "$a" "$b"
Bash Reference