Textantrieb | UText/1 | UText/1.2 Manual
UText Shell
Interactive and batch processing shell
This page describes the Universal-Text Shell as of UText/1.2.
The Perl programm utshell.pl
is a shell for the UText script language both for interactive sessions and batch processing.
Start
Invoking the program without any arguments starts an interactive shell session.
The examples below show a Unix shell with an alias ut
to the program.
francesc@sil10 ~$ ut
Universal-Text Interpreter v1.2 beta; +http://u-tx.net
(c) 2004-2010 Francesc Hervada-Sala
Welcome to the UText Shell. Enter '.' to quit, 'help' for usage.
ut>
To get a list of command line arguments invoke the shell with -h
.
francesc@sil10 ~$ ut -h
Universal-Text Interpreter v1.2 beta; +http://u-tx.net
(c) 2004-2010 Francesc Hervada-Sala
Usage: ut file... [-m module]... [-b] [-r] [-v] [-h]
file: one or more utl file to read
-m one or more add-in module to load
-b batch mode (no interactive session)
-r show names of files when reading
-v verbose log
-h show these usage lines and quit
francesc@sil10 ~$
Batch Mode
Load Add-In Modules
To load one or more add-in modules before starting, use the -m
argument. For example, to load the modules odt
and types
, do:
ut -m types odt
Read UTL Files
One can pass one or more file names as arguments, these files are read by the given order at startup. Separate file names with spaces. If a file name contains a space, the whole name must be quoted. Example:
ut book.utl "my scripts.utl"
Script Execution
After loading the modules and reading the files indicated by the arguments, the lines provided by the standard input stream are executed by the interpreter in batch mode, if the standard input string was redirected. For example:
ut < some-script.scr
This reads and executes the lines of the file some-script.scr
. Note that this input stream is not an UTL file, but an immediate script. To execute an UTL file, pass its name as argument to the shell.
One can also execute here-docs in a Unix shell this way:
$ ut <<END
[.. script instructions here ...]
END
ut>
Ending Batch Mode
If the standard input stream was not redirected or if its already been completely executed, the batch mode finishes. After the batch mode ends, one enters automatically into the interactive mode. If you do not want the interactive mode to take place, use the command line argument -b
:
ut book.utl -b < generate-latex.scr
or include an exit instruction (a single dot) as last instruction in the script.
$ ut <<END
[.. script instructions here ...]
.
END
$
The only difference between the two options is what happens if an error occurs and execution of the batch script stops. An interactive session starts after the error message only if the program was called without the -b
argument (because the dot was not executed).
Debug Information
With the command line option -r
the names of the files are printed out at the console as the files are being read. The option -v
activates the verbose debug mode. These are the same as the script instruction set debug to file
and set debug to say
respectively (see Setting debug
).
Interactive Mode
In interactive mode the shell waits for user input and interprets each single line as it is fed. The shell prompt ”ut>“ indicates that the interpreter is ready for accepting new input.
An overwiew over the script usage is shown with the instruction help
.
Any script instruction can be executed. For a description of the script language see Universal-Text Script.
Command History
In an interactive session, with the arrow up and down keys one can navigate through previous script commands, the tab key has completion for file names.
After leaving the shell, the command history is saved at a file named .utshell.history
at the current directory. When running the shell the next time, this file is read and the command history persists.
When starting an interactive session, the command history is read from the current working directory, and when leaving it the new history is saved at the same file, so that starting the shell from different directories results in separate command histories.
History and completion functionality pressuposes that a Perl readline
library has been installed (see Installation).
Quitting
To quit the interactive session, press ^D
(Ctrl+D) or enter a single dot:
francesc@sil10 ~$ ut
Universal-Text Interpreter v1.2 beta; +http://u-tx.net
(c) 2004-2010 Francesc Hervada-Sala
Welcome to the UText Shell. Enter '.' to quit, 'help' for usage.
ut> .
francesc@sil10 ~$
If a line is fed but the script instruction is not complete, the interpreter shows the prompt ut...>
and waits for more lines until the whole instruction is complete before executing it. A multiple line instruction can be aborted entering a single dot:
ut...> .
ut>
Tag
The following tag is defined by this program in interactive mode (s. Tags for details):
- help: shell usage