EVAL is used to evaluate and print the answer of an integer expression. The fractional portion of input values and final results, if any, is truncated (cut off). If a non-integer is given as an input value, evaluation stops at the decimal point.
<Value1> and <value2> can be decimal (the default), hexadecimal, or octal numbers. Hexadecimal numbers are indicated by either a leading Ox or #x. Octal numbers are indicated by either a leading 0 or a leading #. Alphabetical characters are indicated by a leading single quotation mark (`) and are evaluated as their ASCII equivalent.
The LFORMAT keyword specifies the formatting string used to print the answer. You can use %X (hexadecimal), %O (octal), %N (decimal), or %C (character). The %X and %O options require a number of digits using the LFORMAT keyword, you can specify to print a new line by including *N in your string.
The supported operations and their corresponding symbols are shown in the following table.
EVAL can be used in scripts as a counter for loops. In that case, use the TO option to send the output of EVAL to a file.
Parentheses can be used in the expressions.
1> EVAL 0x5f / 010 LFORMAT="The answer is %X4*N"
The answer is 000B
1>
This divides hexadecimal 5f (95) by octal 10 (8), yielding 000B, the integer portion of the decimal answer 11.875. (The 1> prompt appears immediately after the 000B if *N is not specified in the LFORMAT string.)
For more examples using the EVAL command, see Chapter 8.
Executes a script with optional argument substitution.
EXECUTE is used to run scripts of AmigaDOS commands. The lines in the script are executed as if they had been entered at a Shell prompt. If the s protection bit of a file is set and the file is in the search path, enter only the file name; the EXECUTE command is not needed.
You can use parameter substitution in scripts by including special keywords in the script. When these keywords are used, you can pass variables to the script by including the variable in the EXECUTE command line. Before the script is executed, AmigaDOS checks the parameter names in the script against any arguments given on the command line. If any match, AmigaDOS substitutes the values specified on the command line for the parameter name in the script. You can also specify default values for AmigaDOS to use if no variables are given. If you have not specified a variable and there is no default specified in the script, then the value of the parameter is empty (no substitution is made).
The allowable keywords for parameter substitution are explained in Chapter 5. Each keyword command line must be prefaced with a dot character (.).
See also: IF, SKIP, FAILAT, LAB, ECHO, RUN, QUIT. For examples using the EXECUTE command, see Chapter 8.
Instructs a command sequence not to fail unless a given error condition is returned.
Commands indicate that they have failed by setting a nonzero return code. The return code, normally 5, 10, or 20, indicates the severity of the error. A return code greater than or equal to a certain limit, the fail limit, terminates a sequence of non-interactive commands (commands specified after RUN or in a script).
Use the FAILAT command to alter the fail limit RCLIM (Return Code Limit) from its initial value of 10. If you increase the limit, you indicate that certain classes of error should not be regarded as fatal and that execution of subsequent commands can proceed after the error. The argument must be a positive number. The fail limit is reset to the initial value of 10 on exit from the command sequence.
If the argument is omitted, the current fail limit is displayed.
Assume a script contains the following lines:
COPY DF0:MyFile to RAM:
ECHO "MyFile being copied."
If MyFile cannot be found, the scripts is aborted and the following message appears in the Shell window:
COPY: object not found
COPY failed returncode 20:
However, if you changed the return code limit to higher than 20, the script continues even if the COPY command fails. For example, if you changed the script to read:
FAILAT 21
COPY DF0:MyFile to RAM:
ECHO "MyFile being copied."
Even if MyFile cannot be found, the script continues. The following message appears in the Shell window:
COPY: object not found
MyFile being copied.
Prints the messages for the specified error numbers.
FAULT prints the messages corresponding to the error numbers supplied. As many error numbers, separated by spaces, as you want can be specified to print at the same time.
If you receive the error message:
Error when opening DF1:TestFile 205
and need more information, enter:
1> FAULT 205
FAULT 205: object not found
This tells you that the error occurred because TestFile could not be found on DF1:.
A complete list of error messages appears in Appendix A.
|