The values printed are given history numbers by which you can refer to them. These are successive integers starting with one. print shows you the history number assigned to a value by printing ‘$num=’ before the value; num is the history number.
To refer to any previous value, use ‘$’ followed by the value’s history number. The way print labels its output is designed to remind you of this. Just $ refers to the most recent value in the history, and $$ refers to the value before that. $$ n refers to the nth value from the end; $$2 is the value just prior to $$, $$1 is equivalent to $$, and $$0 is equivalent to $.
For example, suppose you have just printed a pointer to a structure and want to see the contents of the structure. It suffices to type p *$.
If you have a chain of structures where the component next points to the next one, you can print the contents of the next one with p *$.next. You can print successive links in the chain by repeating this command— which you can do by just using the Return key.
Note that the history records
values, not expressions. Consider, for instance, if the value of x
is 4 and you type the following example’s commands.
show values n
show values +