spec

Software for Diffraction

1.3.2. - Command Recall (History)



A command recall (or history) feature lets you recall previously typed commands. spec's command recall implements a subset of the features of the standard csh history mechanism. When using command recall, note that only keyboard input is saved, command recall cannot be used in command files, and the command recall characters must occur at the beginning of a new line.

When you run spec interactively, a command sequence number is always prepended to the prompt. The history command lists by number the commands that can be recalled. (At present, only the most recent 1000 commands are available for recall.)
1.FOURC> history
   1  p 2+2, sqrt(3), "2^16 =", 1<<16    2  p 100, 0100, 0x100    3  p date()    4  p date(1e9)    5  p date(0)    6  p time(), date(time())    7  TITLE = input("Please enter a title: ")    8  history 2.FOURC>



To use command recall, type !! or !-1 to recall the previous command. Typing !-2 will recall the second previous command. Type !2 to recall command number 2. Also, !TI will recall the last command beginning with the string TI.
1.FOURC> !2
p 100, 0100, 0x100 100 64 256 2.FOURC>

Notice that the recalled command is first printed and then executed.

Recalled commands can be modified by appending text.
1.FOURC> !p , "= 100, 0100 and 0x100.
p 100, 0100, 0x100 "= 100, 0100 and 0x100." 100 64 256 = 100, 0100 and 0x100. 2.FOURC>

Arbitrary substitutions to recalled commands are allowed using the :s/left/right/ modifier, as in
1.FOURC> !-1:s/./,respectively./
p 100, 0100, 0x100 "= 100, 0100 and 0x100, respectively." 100 64 256 = 100, 0100 and 0x100, respectively. 2.FOURC>

You can also use a circumflex ^ to make a substitution on the most recent command, just as with the standard UNIX csh.
1.FOURC> ^=^are^
p 100, 0100, 0x100 "are 100, 0100 and 0x100, respectively." 100 64 256 are 100, 0100 and 0x100, respectively. 2.FOURC>