HP zx2000 Technical Reference Manual page 62

Hp zx2000: reference guide
Table of Contents

Advertisement

System Configuration
positional arguments
Up to nine positional arguments are supported for batch scripts. Positional argument substitution
is performed before the execution of each line in the script file. Positional arguments are denoted
%n
by
, where n is a digit between 0 and 9. By convention,
currently being executed.
In batch scripts, argument substitution is performed first, then variable substitution. Thus, for a
variable containing
argument on the command line. If no real argument is found to substitute for a positional
argument, then the positional argument is ignored.
For example, this sample script replaces the two literal arguments
positional arguments
echo -off
set arg1 %1
set arg2 %2
echo "I found a %arg1%"
echo "I also found a %arg2%"
To run the command, type the command name followed by the arguments at the shell
prompt:
fs0:\efi\tools> example cat dog
example> echo -off
I found a cat
I also found a dog
nesting
Script file execution can be nested; that is, script files may be executed from within other script
files. Recursion is allowed.
output redirection
Output redirection is fully supported. Output redirection on a command in a script file causes the
output for that command to be redirected. Output redirection on the invocation of a batch script
causes the output for all commands in the batch script to be redirected to the file, with the output
of each command appended to the end of the file.
By default, both the input and output for all commands executed from a batch script are echoed
to the console. Display of commands read from a batch file can be suppressed via the echo -off
command (see echo). If output for a command is redirected to a file, then that output is not
displayed on the console.
error handling in scripts
By default, if an error is encountered during the execution of a command in a batch script, the script
will continue to execute. The
most recently executed command using the if command. This variable is not an environment variable,
but is a special variable maintained by the shell for the lifetime of that instance of the shell.
comments in script files
Comments can be embedded in batch scripts. The
on the same line and to the right of the
to the console.
3–10
%2
, the variable will be replaced with the literal string
%1
%2
and
:
lasterror
shell variable allows batch scripts to test the results of the
#
are to be ignored by the shell. Comments are not echoed
%0
is the name of the script file
arg1
and
#
character on a line denotes that all characters
%2
, not the second
arg2
with the
technical reference guide

Advertisement

Table of Contents
loading

Table of Contents