phil294
phil294

Reputation: 10852

Convenience variables via command file

Convenience variables can be defined like

set $i = 0

However, when executed from a file:

gdb -command COMMANDFILE

or from stdin:

gdb <<< "set $i = 0"

, gdb prints

(gdb) A syntax error in expression, near '= 0'.`

Why? How can I use custom variables this way?

Defining such a variable in a break command or as part of a user-defined command did not help either.

Upvotes: 0

Views: 145

Answers (1)

phil294
phil294

Reputation: 10852

I just now found the solution. It was my mistake:

$i

is also bash syntax and thus, from stdin, it has to be escaped in some way.

Upvotes: 1

Related Questions