
Command Reference
114089 Rev. A 2-13
The backslash character (\) allows you to continue a command line on the
following physical line. When used in this way, the backslash is referred to as a
line continuation character. The line continuation character makes it easier for
you to read the script file. The maximum command line size is still restricted to
255 characters. The following example shows an
if command using the backslash
character:
if $num = 1 then ; \
echo “The number is 1”;
We recommend that you indent the additional commands to make the script file
easier to read. Also, if there is a large amount of code following the
if command,
use a
goto command to branch around the conditional code, as shown in the
following example.
if $num !=1 then ; goto :IF_10:
echo “the number is 1”;
:IF_10:
The following script shows how the if command is used to pass parameters into
the script file.
echo “Number of parameters entered on run line: $#”
let index = 1
:LOOP:
if $index > $# then; goto :LOOP_END:
echo “Parameter $index: ${[$index]}”
let index = $index + 1
goto :LOOP:
:LOOP_END:
To test whether a variable is defined, use the if command with the following
syntax:
if $?
<variable_name>
=1
where 1=defined.
For example, the following script tests whether variable
a has been defined:
setenv a 5
if $?a=1 then; \
echo “Defined”
Comentários a estes Manuais