Menu

#70 watch a variable with multiple strings caused errors

v1.0_(example)
open
nobody
watch (1)
5
2021-07-06
2021-07-06
No

watch a variable with multiple strings caused errors

mon_test.sh
ARGS=$@

$ bashdb -- mon_test.sh "Hello World !"

bashdb<2> watch ARGS
/usr/share/bashdb/lib/msg.sh: line 127: printf: World: invalid number
/usr/share/bashdb/lib/msg.sh: line 127: printf: !: invalid number

0: ($ARGS)==Hello arith: 0 0: 0== arith: 0

$bashdb_location/bashdb/command
$ diff -u watch.sh.ORIG watch.sh

--- watch.sh.ORIG 2021-06-25 11:20:34.000000000 +0200
+++ watch.sh 2021-07-06 11:42:17.000000000 +0200
@@ -64,7 +64,7 @@
_Dbg_watch_enable[$n]=1
_Dbg_watch_count[$n]=0
_Dbg_printf '%2d: %s==%s arith: %d' $n \
- "(${_Dbg_watch_exp[$n]})" ${_Dbg_watch_val[$n]} \
+ "(${_Dbg_watch_exp[$n]})" "${_Dbg_watch_val[$n]}" \
${_Dbg_watch_arith[$n]}
fi
return 0

Discussion

  • Rocky Bernstein

    Rocky Bernstein - 2021-07-06

    Thanks! Should be fixed in the bash-4.2, bash-4.4, bash-5.0, and bash-5.1 branches in commits 2912083, fba89d9, dd9847b, and 9ccf28b respectively.

    But I make lots of mistakes which is why I work on debuggers. So please double check.

     
  • Roland Christmann

    oki thanks for your quick reaction. I will be happy to try the 5.1 version.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.