As I said in the overview section there are three modes to execute batch commands:
- Run commands from a file
- Run commands from standard input.
- Run commands specified on the command line - this is a convenient way to run a short list of commands.
Running Commands From a File
To run commands from a file you should use the -f parameter to specify a file containing commands when launching Nuxeo Shell.
Where my_batch_file is a file containing the commands to execute - each command on one line. Empty lines and lines beginning with # are ignored. The # character can be use to add comments to a batch file.
Here is an example of a batch file:
If you want to span a command on multiple lines (you may want this for improved readability in case of long commands) you can end the line with a * character (*make sure you don't have a space after **). In that case the command will continue on the next line, and so on until no more line ending ** is found or the end of file is reached.
Running Commands From Standard Input
If you want to run batch commands from the terminal standard input you can use the - option when launching the Nuxeo shell.
The format of the commands is the same as the one described when running commands from a file.
Here is an example which will run the commands from my_batch_file file by using the Unix cat application and pipes:
Running Batch Commands from the Command Line
If you just run a few short commands you can specify them directly in the command line of the Nuxeo Shell.
Note that commands are separated using a semicolon character.
You cannot run that way commands that contains illegal characters and needs to be escaped.