Difference between revisions of "UNIX Script Syntax"

From Vital Soft Wiki
Jump to: navigation, search
>Johno
>Johno
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:
 
</pre>
 
</pre>
 
*Other command line parameters, such as -aprofile, may be specified prior to the "<<".   
 
*Other command line parameters, such as -aprofile, may be specified prior to the "<<".   
*The syntax '''<< EOD''' syntax causes all the commands which follow in the script (up to the specified label) to be passed as input to the AskPlus program.   
+
*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-".   
 
*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.
 
*Script files generated by Visimage3 (File > Create UNIX Scipt File) will automatically escape all $ characters.

Latest revision as of 17:20, 8 July 2020

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.