All modern operating systems have a script language whereby system commands can be grouped into a file and then executed as if they were being entered, one line at a time, by a person. In the case of the Microsoft Windows command prompt and PowerScript, those files were originally know as "batch" files and have the extension .BAT. In Unix/Linux, they are called "shell scripts." In A-Shell they are known as "command files" and may have the extension .DO or .CMD. Files with the .CMD extension do not allow argument substitution and macro expansion, but otherwise are identical to .DO files in both structure and execution.
In addition to the normal commands that make sense at the command prompt, command files also support some special commands and symbols which only make sense within files, and which allow them to be somewhat more program-like. Consider the following sample DO file (main.do), then see the following sections for more information.
Command File Comments
The comment character is the semicolon ( ; ). This is equivalent to Unix which uses the pound sign ( # ) and Windows which uses "REM". The comment character may appear anywhere in the command line, with the exception that labels, which have the same syntax as a one-word comment, must start in column one. See the line ";DONE" in the sample file below.
Example: MAIN.DO
$D 100 MENU ; defaults for $0 and $1
:T ; trace (echo) commands
LOG DSK0:[150,$0]
:R ; don’t trace commands
IF LOOKUP ("MENU.DAT") = 0
:<Sorry, no MENU.DAT here
>
GOTO DONE
ENDIF
RUN $1
;DONE ; (this is a label)
IF "$NU" <> "admin" ; force all users except "admin"
HOST ; to exit A-Shell
ELSE
:<
Now returning to cmd prompt...
>
ENDIF
Subtopics
•