# bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
# bashdb --version
bashdb, release 5.0-1.1.0
# cat bashdb-test
#!/bin/bash
line='= asd'
if [[ "$line" =~ ^=\ (.*) ]]; then
echo yes
else
echo no
fi
echo bye
When I bashdb on this file and type next trhee times I get this error mesaage:
/usr/share/bashdb/lib/hook.sh: eval: line 285: conditional binary operator expected
/usr/share/bashdb/lib/hook.sh: eval: line 285: syntax error near `asd'
/usr/share/bashdb/lib/hook.sh: eval: line 285: `[[ = asd =~ ^=\ (.*) ]]'
although everything else runs as expected.
Commit #57b18c2 might fix things. Please double check though.
This is about all the time in the near future I'll be able to spend on this. In case you want to improve or work up a regression test based on your test, here is what was going on.
We need to save and BASH_REMATCH going into the debugger and restore it leaving so that if the debugged program uses that variable it has the value it set rather than something the debugger might have set.
On Mon, Oct 7, 2019 at 3:04 PM tien ho van hvtien.ch@gmail.com wrote:
I am not totally sure what you mean, but when
eval $_Dbg_last_regmatch_command
is commented out, thenBASH_REMATCH
might not be not set properly on debugger exit.As a result a program like this:
Will not work properly when it is stepped through.
What would be a big help would be to write a test case that incorporates both bash scripts that might fail: the one that you started with and the one I just gave.
Thanks for all the help.
Last edit: Rocky Bernstein 2019-10-07