test_v doesn't work for associative arrays

2016-06-10 Thread pskocik
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-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 -g 
-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security -Wall
uname output: Linux laptop 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 
09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:
[Detailed description of the problem, suggestion, or complaint.]

Repeat-By:
#!/bin/bash
declare var
declare -a ary
declare -A asoc

var=1
ary=(1)
asoc[a]=1

for a in var ary asoc; do
   printf '%s\t' "$a"
   if test -v "$a"; then
 echo ✓
   else
 echo ✗ 
   fi
done

<

An interrupting ^C in inter. mode doesn't restore FUNCNAME by default

2016-07-15 Thread pskocik
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-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 -g 
-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security -Wall
uname output: Linux laptop 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 
09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:
This is in reference to 
http://unix.stackexchange.com/questions/296123/sigint-is-not-cleaned-up-in-funcname?noredirect=1#comment519834_296123

Interrupting a function with ^C in interractive mode doesn't remove the 
function
from the function stack (FUNCNAME).

`trap ' ' INT` fixes the problem, but it might be worth considering 
cleaning the stack by  default. (`zsh` does remove the interupted function 
chain from ${funcstack[@]}
upon an ^C interrupt).

Repeat-By:
a(){ echo Performing: "${FUNCNAME[@]}"; sleep 10; }
a
^C



Curious case statement error

2016-08-13 Thread pskocik
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-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 -g 
-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security -Wall
uname output: Linux laptop 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 
09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:

In the enclosed example ( based on 
http://unix.stackexchange.com/questions/303166/doesnt-work-the-bash-script-to-check-given-single-character-is-in-lower-case-or
 ), bash always echos Lowercase, whereas all dash, zsh, and ksh echo 
Lowecase/Uppercase pairs as expected.

Repeat-By:
uplow:

read d
case $d in
[a-z]) echo "Character is in Lowercase";;
[A-Z]) echo "Character is in Uppercase";;
esac

test:
for sh in bash dash ksh zsh; do echo $sh; $sh uplow <<