suve

awful: manual: command line options

When invoking awful, it is possible to provide command line options to change the interpreter's behaviour. Short options (-o and -e) must be followed by another argument, describing the file to use. Long options appear alone. Any possible options must appear BEFORE the name of the script to be interpreted; option parsing stops at this point and the script is executed immediately (or not, if --norun was used).

Options supported by the interpreter

-o FILE Redirect all output to FILE, overwriting it. If file cannot be written, stdout will be used.
-O FILE Redirect all output to FILE, appending to end of file. If file cannot be written, stdout will be used.
-e FILE Redirect all error output to FILE, overwriting it. If file cannot be written, stderr will be used.
-E FILE Redirect all error output to FILE, appending to end of file. If file cannot be written, stderr will be used.
-i FILE Instead of stdin, take input from FILE.
--norun Do not run the script and only perform a syntax check.
--version Print interpreter version and exit.
-O, -E and -i became available in rev. 36.

Passing arguments to the script

Like stated above, option parsing stops when the filename of the script to be interpreted is found. Any subsequent command-line options are treated as arguments to be passed to the script. They can be retrieved using the :param-arr, :param-cnt and :param-str functions.

Example

awful -o result.txt script.yuk data.txt
awful will interpret the script found in script.yuk, putting all its output in result.txt. The script will receive one parameter - the string data.txt.

wikipage modified on 2014/0601/2317