JANOS Help System: [Commands] [Topics] [Tech Support] [Printable Manual] [Search]
RUN/EXEC User Commands NAME run - Execute Script exec - Executes commands in batch mode SYNOPSIS run SCRIPT PARAMETERS exec BATCH DESCRIPTION JANOS uses a PHP-like language for scripting. In batch file execution, scripts may be used to render batch file commands which are then executed. This is analogous to using PHP to render an HTML document which is then served to a browser. The RUN command executes the script the results of which are simply sent to the display. In this case the SCRIPT is essentially a program. The SCRIPT file typically has a PRG file extension. If an extension is omitted then .PRG is assumed. The system searches for the SCRIPT file as it would a Java program. Scripts may be placed in the /flash folder and easily executed without path or extension using RUN. Script files accept PARAMETERS as do batch files and Java applications. The EXEC form of the command simply executes the supplied BATCH file. This is equivalent to entry of the filename at the command line except that the BAT file extension is not required. NOTES The RUN command can be used to render a batch program allowing you to examine the resulting commands without executing them. Once you are satisfied that the script generates the correct command set you can execute the batch file normally. A SCRIPT could be written to output information using the ECHO command allowing it to be used without the RUN command in batch mode. Scripts are compiled and therefore run fairly efficiently. The resulting compiled script is cached for the duration of the command session. The RUN/EXEC command will process a piped command set. EXAMPLES Let's take the following script easily created in the /flash/hello.bat file using the ED editor. Here we display the script and use GREP to enumerate the lines for us. bruce_dev /> cat /flash/hello.bat | grep -n 1: <? 2: print('@echo "Yo! Hows it goin?"'); 3: ?> bruce_dev /> Here we use the script PRINT command to output a single command line utilizing ECHO to offer the hello salutation. The '@' in the created command line instructs the batch processing to not echo the command itself. We just want to see the greeting. The script can be simply executed by name. bruce_dev /> hello Yo! Hows it goin? bruce_dev /> We can use RUN to validate the script output without executing it as follows. This shows you what the script produces without invoking the batch processor to execute the line. bruce_dev /> run hello.bat echo "Yo! Hows it goin?" bruce_dev /> Although we execute this script by simply entering its name on the command line we could more explicitly cause it to execute using the EXEC command. bruce_dev /> exec /flash/hello.bat Yo! Hows it goin? bruce_dev /> Now we can see the difference between RUN and EXEC. Here we use RUN to render the command and then hand that to the batch processor for the same now familiar result. bruce_dev /> run hello.bat | exec Yo! Hows it goin? bruce_dev /> Just a word about the script. In the program above, line 3 is unnecessary as the end of file is a suitable termination for a script. Also, in this case the script performs such a simplistic action that the scripting is really itself unnecessary. You might imagine, however, that you may want to create a more complicated procedure like that in the CKSUMS script. SEE ALSO HELP Topics: BATCH, SCRIPTING, PHP, CKSUMS [/flash/manpages/manpages.hlp:4022]