|
parse
Executes commands from a file
|
Usage |
parse [-q] [-e] [-f] [-r] <filename> [<parameter1> [<parameter2> [...]]]
|
Description |
Executes commands from the external file <filename>.
<filename> can be an absolute or relative path.
If it is a relative path then KVIrc will try to look it up
in the path of the calling script (if any) and in the current
KVIrc working directory.
[parameters] is a space separated string of parameters to be
passed to the script. The parameter $0 will contain the
path of the file being parsed, the other parameters will
be available starting from $1.
If <filename> is an existing directory name a file dialog
will pop up, allowing you to choose a file to parse.
The file dialog will start in the directory specified by <filename>.
If you don't know the name of an existing directory, just pass "."
or "/". The command just prints a warning if the file cannot be loaded for
some reason. If you want the command to stop with an error in
this case then use the -e switch.
This command has a builtin alias called include.
|
Switches |
-e | --fail-on-load |
Causes the command to terminate with an error when the file can't be loaded: the error termination stops the parsing of the current script too. If the -e switch is not used then file load failures are eventually reported only as a warning or not reported at all (if -q is used). |
-f | --fail-on-error |
Causes the command to terminate with an error when the execution of the script loaded from disk generates an error. This error termination stops the parsing of the current script too. If the -f switch is not used then the loaded script errors do not stop the current script. |
-q | --quiet |
Causes the command to run quietly without printing warnings about empty <filename> and file loading errors. |
-r | --propagate-return |
Causes the return value of the script to be propagated to the calling context. This allows the usage of ${ } trick to extract this return value. See the examples section for a sample usage. |
|
Syntax Specification |
parse [-q] [-e] [-f] [-r] <filename:string> [<parameter1:variant> [<parameter2:variant> [...]]]
|
Examples |
parse /home/pragma/myscript.kvs
|
# Here we are assuming that fetchdata.kvs returns a string
# We evaluate the return value thru ${} and echo it
echo ${ parse -r /home/pragma/fetchdata.kvs; };
|
|