Re: Bug in select-command

2017-06-25 Thread Chet Ramey
On 6/24/17 1:38 PM, Eduardo A. Bustamante López wrote: > On Sat, Jun 24, 2017 at 01:17:23PM -0400, Chet Ramey wrote: > [...] >> You haven't exported these. If you had, the subshell started to run the >> script would have the correct values. > > Hm. I think this may be a documentation / usability

Re: Bug in select-command

2017-06-25 Thread Chet Ramey
On 6/24/17 10:46 AM, Eduardo A. Bustamante López wrote: > I think this is an easier way to reproduce the problem. I have a terminal > window with the following dimensions: > > dualbus@debian:~$ declare -p COLUMNS LINES > declare -- COLUMNS="191" > declare -- LINES="49" > > dualbus@debian

Re: Bug in select-command

2017-06-25 Thread Chet Ramey
On 6/24/17 7:46 AM, sky...@top-email.net wrote: > It is necessary to refresh the variable $COLUMNS in a script (COLUMNS="tput > cols") otherwise the command "select" will not set the number of columns > correctly for actual screen resolution. > > Information: checkwinsizeon I can't

Re: Bug in select-command

2017-06-24 Thread Eduardo A . Bustamante López
On Sat, Jun 24, 2017 at 01:17:23PM -0400, Chet Ramey wrote: [...] > You haven't exported these. If you had, the subshell started to run the > script would have the correct values. Hm. I think this may be a documentation / usability problem. The manual states the following: COLUMNS Us

Re: Bug in select-command

2017-06-24 Thread Chet Ramey
On 6/24/17 10:46 AM, Eduardo A. Bustamante López wrote: > I think this is an easier way to reproduce the problem. I have a terminal > window with the following dimensions: > > dualbus@debian:~$ declare -p COLUMNS LINES > declare -- COLUMNS="191" > declare -- LINES="49" You haven't exported

Re: Bug in select-command

2017-06-24 Thread Chet Ramey
On 6/24/17 7:46 AM, sky...@top-email.net wrote: > It is necessary to refresh the variable $COLUMNS in a script (COLUMNS="tput > cols") otherwise the command "select" will not set the number of columns > correctly for actual screen resolution. So you are saying that the value of COLUMNS passed in

Re: Bug in select-command

2017-06-24 Thread Eduardo A . Bustamante López
Chet: I think the patch below could be a useful addition, to make the behavior in this case a little bit less surprising. *** /tmp/BdLnYa_shopt.def 2017-06-24 10:21:15.029707643 -0500 --- builtins/shopt.def 2017-06-24 10:17:00.540600773 -0500 *** *** 134,139 --- 134,140 -

Re: Bug in select-command

2017-06-24 Thread Eduardo Bustamante
On Sat, Jun 24, 2017 at 9:46 AM, Eduardo A. Bustamante López wrote: [...] > For some reason though, the following fails to update the value of COLUMNS: [...] > echo \$- $- > echo cols $(tput cols) > command true # this should trigger? > select opt in "${options[@]}"; do > break > don

Re: Bug in select-command

2017-06-24 Thread Eduardo A . Bustamante López
On Sat, Jun 24, 2017 at 01:46:00PM +0200, sky...@top-email.net wrote: [...] > > ### DEFINE FUNCTIONS ### > _config-keymap() { > # Select keymap > # find keymap list, cut directory path and sort > local list_keymaps=( $(find /usr/share/kbd/keymaps/ > -type

Bug in select-command

2017-06-24 Thread sky...@top-email.net
It is necessary to refresh the variable $COLUMNS in a script (COLUMNS="tput cols") otherwise the command "select" will not set the number of columns correctly for actual screen resolution. Information:checkwinsizeon Please try this script-example to see the effect: #!/bin/bash