UNIX Script Syntax

From Vital Soft Wiki
Jump to: navigation, search

Creating a UNIX Script File

On UNIX, the "-b" command line parameter is required so that AskPlus "knows" that it is running in batch. If this parameter is omitted, AskPlus will attempt to prompt the user for input (for example when requesting permission to purge a file or when qualifying an ambiguous item) and will expect the next line of the script to contain a valid response. The most basic AskPlus run command is:

/ASKPLUS/askplus -b << EOD
open database;
find ...
report ...
exit
EOD
  • Other command line parameters, such as -aprofile, may be specified prior to the "<<".
  • The << EOD syntax instructs UNIX to pass all the commands which follow in the script (up to the specified label) as input to the AskPlus program.
  • By default, UNIX will perform $variable substitution before passing the input lines to AskPlus. If the label is enclosed in single quotes (<< 'EOD'), UNIX will not modify the lines in any way. If single quotes are not used, any AskPlus statement that uses a $ ($DATE or "$$$,$$9.99-") must be escaped with a '\' (back slash). For example \$DATE or "\$\$\$,\$\$9.99-".
  • Script files generated by Visimage3 (File > Create UNIX Scipt File) will automatically escape all $ characters.