0

Anyone clarify what the definitive difference between:

 3<&0

and

 exec 3<&0

of bash or other akin shell? thanks before

oguz ismail
  • 1
  • 16
  • 47
  • 69

1 Answers1

5

The difference is that file descriptor 3 remains open after exec 3<&0. See:

$ cat foo
bar
$
$ 3<foo
$ cat <&3
bash: 3: Bad file descriptor
$
$ exec 3<foo
$ cat <&3
bar
$
oguz ismail
  • 1
  • 16
  • 47
  • 69