1

Why does this set a breakpoint properly:

gdb -ex 'break file.cpp:100' -ex run --args myProg

But this does not work:

BP1="-ex 'break file.cpp:100'"
gdb $BP1 -ex run --args myProg
Cyrus
  • 84,225
  • 14
  • 89
  • 153
clearlight
  • 12,255
  • 11
  • 57
  • 75
  • 1
    Putting quotes in a variable doesn't work; once they're in a variable, they're treated as data, not shell syntax. See ["Why does shell ignore quoting characters in arguments passed to it through variables?"](https://stackoverflow.com/questions/12136948/why-does-shell-ignore-quoting-characters-in-arguments-passed-to-it-through-varia). Use an array to store the argument list instead of a regular variable, and ignore all suggestions involving `eval` (it's a massive bug magnet). – Gordon Davisson Oct 26 '21 at 06:45

0 Answers0