Next: , Up: Commands


4.1 builtin commands

Built-in commands pertain to the interpreter, and have no relation to simulation.

— Command: help cmd

Help on command or category cmd. ‘help all’ gives a list of all commands available in all categories. ‘help help’ tells you how to use help.

— Command: # ...
— Command: comment ...

Whole line comment, ignored by interpreter.

— Command: echo output

Print output to stdout. Note: multiple spaces in output are compacted into single spaces by the interpreter's tokenizer.

— Command: exit
— Command: quit

Exit the simulator.

— Command: abort

Exit the simulator with a fatal (non-zero) exit status.

— Command: precision [n]

Sets the precision of real-valued numbers to be printed. Without an argument, this command just reports the current precision.

— Command: repeat n cmd...

Repeat a command cmd a fixed number of times, n. If there are any errors in during command processing, the loop will terminate early with a diagnostic message.

— Command: history [start [end]]

Prints command history. If no arguments given, then print entire command history. If only start is given, print to the most recent line. If start is negative, count backwards from last line. If end is positive, count forward from start. If end is negative, count backward from last line.

— Command: history-noninteractive [on|off]

Controls the recording of non-interactive commands in the history.

— Command: history-save file

Writes command line history to file file.

— Command: history-rerun start [end]

Reruns a set of previous commands. start is the first line to rerun. If end is omitted, only one line is rerun. If end is negative, count backwards from the most recent to determine the last line to run in the range. If end is positive, take that as the number of lines to execute from start, inclusive.

— Command: interpret

Open an interactive subshell of the interpreter, by re-opening the standard input stream. This is useful when you want to break in the middle of a non-interactive script and let the user take control temporarily before returning control back to the script. Ctrl-D sends the EOF signal to exit the current interactive level of input and return control to the parent.

— Command: ! shell-cmd

Shell escape. Execute shell-cmd in parent shell, like the ‘system’ library function, e.g. ‘!date’. Note: this preserves the rest of the line after the `!' verbatim.

The following commands are related to command aliases. Every command line given to the interpreter recursively expands the first token if it has a known alias. Aliases may reference to other aliases in the first token. The interpreter is smart enough to catch cyclic aliases and report an error.

— Command: alias cmd args

Defines an alias, whereby the interpreter expands cmd into args before interpreting the command. args may consist of multiple tokens. This is useful for shortening common commands.

— Command: aliases

Print a list of all known aliases registered with the interpreter.

— Command: unalias cmd

Undefines an existing alias cmd.

— Command: unaliasall

Undefines all aliases.

The following commands emulate a directory like interface for navigating the instance hierarchy, reminiscent of shells. By default, all instance references are relative to the current working directory, just like in a shell. Prefix with ‘::’ to use absolute (from-the-top) reference. Go up levels of hierarchy with ‘../’ prefix. The hierarchy separator is ‘.’ (dot).

— Command: cd dir

Changes current working level of hierarchy.

— Command: pushd dir

Pushes new directory onto directory stack.

— Command: popd

Removes last entry on directory stack.

— Command: pwd

Prints current working directory.

— Command: dirs

Prints entire directory stack.

The following command is useful for showing each executed command.

— Command: echo-commands arg

Enables or disables echoing of each interpreted command and tracing through sourced script files. arg is either "on" or "off". Default off.