I found this issue reading the source code of execute_cmd.c.
Tested/verified in 5.3, but I think the issue has been there more or
less forever.
This fits in with the theme I've advanced elsewhere (most recently, in
help-bash) about how 'select' should not be using stderr - but if it
is going to use stderr, it should be consistent about it.
Line 3468 of execute_cmd.c is: putchar('\n');
The purpose of this line is to emit a newline when the user hits ^D at
the 'select' prompt (#?). If this line were not present, the cursor
would stay on the same line as the #? prompt, which would be unsightly.
However, I think this should be (f)putc('\n',stderr);
You can demonstrate the issue by running the following command (with and
w/o the final redirection):
$ select p in one two three; do echo "pick = $pick" > /dev/tty;done > /tmp/XXX
Now, you could argue that it is unlikely that someone would be using
'select' with stdout redirected, but, to quote my man Chuck Berry,
you never can tell...
=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.
When responding to my posts, please try to refrain from giving bureaucratic
answers.
If you have nothing useful to say, then just click Next and go on.