On Tuesday, December 13, 2011 12:14:41 PM lhun...@mbillemo.lin-k.net wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i386 > OS: darwin11.2.0 > Compiler: /Developer/usr/bin/clang > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' > -DCONF_OSTYPE='darwin11.2.0' -DCONF_MACHTYPE='i386-apple-darwin11.2.0' > -DCONF_VENDOR='apple' -DLOCALEDIR='/opt/local/share/locale' > -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DMACOSX -I. -I. -I./include > -I./lib -I/opt/local/include -pipe -O2 -arch x86_64 uname output: Darwin > mbillemo.lin-k.net 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 > PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64 Machine Type: > i386-apple-darwin11.2.0 > > Bash Version: 4.2 > Patch Level: 10 > Release Status: release > > Description: > The description of declare states that using + instead of - in front of > an > attribute turns it off. From that, I would expect (and find useful) to be > able to display (-p) all non-read-only variables using declare +r -p, just > like I can display all readonly variables using declare -r -p > > Repeat-By: > declare +r -p > > Fix: > Show all variables that do not have the given attribute(s) when included > in the declare command prefixed with a +.
Would this be consistent with anything else? AFAIK the only option for filtering results is -f and -F unless no additional "names" are given. "declare +l -p" for example doesn't appear to select only non -l attribute names either. ksh93 appears mostly consistent with this and prints matches regardless of + or -. I imagine this is ok because Bash's declare -p is intended to be human- readable only, whereas Ksh guarantees -p produces output in a format reusable as input. $ ( typeset -r x=0; typeset y=1; typeset -p x y ) typeset -r x=0 y=1 $ ( typeset -r x=0; typeset y=1; typeset -r -p x y ) typeset -r x=0 y=1 $ ( typeset -r x=0; typeset y=1; typeset +r -p x y ) typeset -r x y $ ( typeset -r x=0; typeset y=1; typeset +r ) x $ ( typeset -r x=0; typeset y=1; typeset -r ) x=0 And it has the additional behavior that +p omits values. Bash doesn't do this.
signature.asc
Description: This is a digitally signed message part.