From: <eri...@co...> - 2006-01-03 02:37:43
|
> I've started to look into making the bash debugger work on bash 3.1. > As with bash 3.0, I've checked this in as a separate location > (bash-3.1) rather than make a branch of either bash-3.00 or of bashdb > (for 2.05b). > > In bash 3.0 whereas in the bashdb code one could do this: > > local -a fns_a=(`declare -F`) > > what now seems to work is: > > local -a fns_a > fns_a=(`declare -F`) This issue has been reported several times; official patch 1 is supposed to fix it, but you need a one-line unofficial patch on top of that for array assignments - see the thread at: http://lists.gnu.org/archive/html/bug-bash/2005-12/msg00060.html > > using $() for `' makes no difference. > > And instead of: > if [[ $basename == '$cdir' ]] ; then > > what seems to work is: > if [ $basename = '\$cdir' ] ; then Not quite the same. [[ ]] has different semantics than [ ] (for example, [[ does not perform word splitting, while [ does, so if $basename has spaces, you would need to quote it in the latter). > > I don't know if the incompatibility is intentional or not; if the > mistake was my prior misuse of the language. I report the above in > case others have problems or in case someone else wants to investigate > or make a bug report if one is warranted. Bash 3.1 does have the same bug as bash 3.0 in that [[ ]] does not affect the value of $PIPESTATUS, but as that bug is not a regression, I don't see it affecting you here. However, I wonder where you are assigning $basename before using it in [[ ]]. I was unable to reproduce a failure in [[ ]], and wonder if instead you used some other construct earlier on where bash 3.0 mistakenly expanded quotes twice, but where bash 3.1 correctly only expands quotes once (again, this is related to the earlier change in array parsing syntax, and in the thread mentioned above, Chet Ramey did mention that more quoting characters are preserved). My test case: bash-3.1$ basename=abc bash-3.1$ [[ $basename == '$abc' ]] && echo yes bash-3.1$ basename='$abc' bash-3.1$ echo $basename $abc bash-3.1$ [[ $basename == '$abc' ]] && echo yes yes -- Eric Blake |