read not terminated with EOF/^D when -n or -N is used

2010-12-26 Thread Isaac Good
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/ locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=i686 -mtune=generic -O2 
-pipe -DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin:/ 
bin:/usr/local/sbin:/usr/sbin:/sbin' 
-DSTANDARD_UTILS_PATH='/usr/bin:/bin:/usr/sbin:/sbin' 
-DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux arch 2.6.35-ARCH #1 SMP PREEMPT Tue Sep 21 11:00:23 UTC 
2010 i686 Pentium III (Katmai) GenuineIntel GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.1
Patch Level: 9
Release Status: release



read <^D>   -> the EOF terminates read and it exists with a false 
exist status.
read -n4 <^D>   -> the ^D is read by read and stored in REPLY. read does 
not terminate.



[[ and set -E vs trap ERR

2009-11-16 Thread Isaac Good
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' - DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=i686 
-mtune=generic -O2 -pipe
uname output: Linux arch 2.6.31-ARCH #1 SMP PREEMPT Fri Oct 23 11:12:58 CEST 
2009 i686 Pentium III (Katmai) GenuineIntel GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.0
Patch Level: 35
Release Status: release

cat <<-EOF >test
#!/bin/bash -e
set -E
trap 'echo >&2 "error"' ERR

echo TEST1
if [ $(false) ] ; then
echo 1
fi

echo TEST2
if [[ $(false) ]] ; then
echo 1
fi
EOF

Expected output:
TEST1
TEST2

Actual output:
TEST1
TEST2
error

The [[ masks the fact that an 'if' is running - but only in regards to the 
trap. bash does not exit on this error but the trap is triggered. 
[ works fine.
With set -E, the trap is inherited by command substitution, but the fact that 
the trap is suppressed is not.

<\amethyst> but the manpage says the ERR trap is avoided under "the same 
conditions obeyed by the errexit option", so at least the documentation is in 
error if nothing else




Parameter Expansion: Case Modification: ${var~} not documented

2015-08-18 Thread Isaac Good
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/  locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -
 D_FORTIFY_SOURCE=2 -march=i686 -mtune=generic -O2 -pipe
-fstack-protector-strong --   param=ssp-buffer-size=4
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' -
  DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux netbook 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14
07:48:39 CEST 2014 i686 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.3
Patch Level: 39
Release Status: release

Description:
The man page fails to document the ${var~} and ${var~~} case inversion
expansion.
It got the upper and lower, ie ${var^} and ${var,} but not invert.

Fix:
More documentation.


Re: Parameter Expansion: Case Modification: ${var~} not documented

2015-08-18 Thread Isaac Good
Would you mind sharing the rational behind having it undocumented?

On Tue, Aug 18, 2015 at 7:38 AM, Chet Ramey  wrote:

> On 8/18/15 9:50 AM, Dan Douglas wrote:
>
> >> Description:
> >> The man page fails to document the ${var~} and ${var~~} case inversion
> >> expansion.
> >> It got the upper and lower, ie ${var^} and ${var,} but not invert.
> >>
> >> Fix:
> >> More documentation.
> >
> > I'm pretty sure that's intentional. The corresponding `declare -c` has
> never
> > been documented either.
>
> Correct; it's undocumented.
>
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRUc...@case.edu
> http://cnswww.cns.cwru.edu/~chet/
>


unset array[0] doesn't delete the element

2017-03-04 Thread Isaac Good
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_FORTIFY_SOURCE=2 -march=i686 
-mtune=generic -O2 -pipe -fstack-protector-strong 
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' 
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' 
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS 
-Wno-parentheses -Wno-format-security
uname output: Linux netbook 4.9.11-1-ARCH #1 SMP PREEMPT Sun Feb 19 14:09:53 
UTC 2017 i686 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.4
Patch Level: 12
Release Status: release

Description:
`unset` is broken

Repeat-By:
$ arr=(1 2 3); unset arr[-1]; echo "${arr[@]}"
1 2 3



Re: unset array[0] doesn't delete the element

2017-03-04 Thread Isaac Good
Bug report being withdrawn. I had nullglob set so unset wasn't being
invoked properly.

On Sat, Mar 4, 2017 at 9:10 PM, Isaac Good  wrote:

> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_FORTIFY_SOURCE=2
> -march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong
> -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
> -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
> -DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
> -Wno-parentheses -Wno-format-security
> uname output: Linux netbook 4.9.11-1-ARCH #1 SMP PREEMPT Sun Feb 19
> 14:09:53 UTC 2017 i686 GNU/Linux
> Machine Type: i686-pc-linux-gnu
>
> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
>
> Description:
> `unset` is broken
>
> Repeat-By:
> $ arr=(1 2 3); unset arr[-1]; echo "${arr[@]}"
> 1 2 3
>