Difference between revisions of "UNIX Script Syntax"

From Vital Soft Wiki
Jump to: navigation, search
>Johno
(Created page with "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 use...")
 
>Johno
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
=== 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:
 
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:
 
<pre>
 
<pre>
Line 8: Line 9:
 
EOD
 
EOD
 
</pre>
 
</pre>
Other command line parameters, such as -aprofile, may also 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) to be passed as input to the AskPlus program.  All commands, up to the specified label (in this case EOD) will be passed to the 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.
+
*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.

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.