[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bash 3.2.39] File descriptor 10 is always duplicated from 0 and can
From: |
Jian Wang |
Subject: |
Re: [bash 3.2.39] File descriptor 10 is always duplicated from 0 and cannot be closed |
Date: |
Fri, 31 Oct 2008 16:06:49 +0800 |
On Fri, Oct 31, 2008 at 14:18, Clark J. Wang <dearvoid@gmail.com> wrote:
> Hi, all:
>
> When I was doing some testing I found the file descriptor 10 is always
> duplicate of fd 0 and it cannot be closed.
>
> See the following commands:
>
> # echo $BASH_VERSION
> 3.2.39(1)-release
> # read line <&10
> hello <--- input from keyboard
> # echo $line
> hello
> # exec 10<&- <--- try to close fd 10
> # read line <&10 <--- no error reported, so fd 10 is still open?
> hello <--- input from keyboard
> # echo $line
> hello
> # read line <&11 <--- test with fd 11
> bash: 11: Bad file descriptor
> #
>
And, even though we can read from fd 10 but there's no such an fd under
/proc/$$/fd directory.