Go to the previous, next section.

Talking to the Operating System

Any line from ! to the newline is passed to your shell (DCL under VMS, the Bourne shell under unix. If you set the variable SHELL in either your `.sm' file or the environment it will be used instead; the former takes priority). @footnote #{The first of these commands in a SM session may be rather slow under VMS, as we have to spawn a subprocess.} For example, !ls or !directory will list the current directory. The return code from the command is available in the variable $exit_status, on unix systems it will be 0 for success, for weirder systems you should look in the system manual for the return value of the C function system. $exit_status is one of the variables that can be set with DEFINE exit_status |.

It is also possible to change the directory that SM uses to look for data or macro files with the CHDIR command - for instance CHDIR "../more_data"@footnote %{Unfortunately, this is currently not available to VMS users}. If a directory name starts with `~', CHDIR replaces the `~' with your home directory. This is the only place that `~' is treated specially, for instance it is not interpreted by the DATA command. Because directory names often contain mathematical characters such as [ or /, it is wise to quote the directory, or use the macro cd which quotes it for you.

Go to the previous, next section.