NAME

veda-run-ilx - Run a SKILL/SKILL++ script from the command-line

SYNOPSIS

veda run-ilx script [script-arg]...
veda-run-ilx script [script-arg]...

DESCRIPTION

Runs a SKILL/SKILL++ script in skill, dbAccess, virtuoso -nograph or virtuoso, depending on its requirements.

Scripts are ordinary SKILL files, preceded by a specially-formatted comment header, e.g.:

#!/usr/bin/env veda-run-ilx
;; @language skill
;; @requires testing
printf("Hello, World!\n")

In the above,

Every subsequent line is considered part of the script, and everything but the shebang line, if any, is passed verbatim to the chosen interpreter.

In addition to the installed Veda packages, a number of implementation pseudo-packages are recognized, and cause the selection of an interpreter with the required features. E.g., @requires db triggers evaluation in dbAccess, which is the "minimal" interpreter exposing the Cadence db* API. Here is the list of recognized pseudo-packages and their corresponding minimal interpreter:

The default interpreter, chosen in the absence of a request for any implementation package, is the bare-bones skill interpreter.

Please see VEDA_SKILL_BIN and VEDA_*_BIN in veda help for more information on how interpreters are located.

EXPORTED FUNCTIONS

The run-ilx command defines a single function, VedaRunScriptArgs, which can be used to query the arguments [script-arg]... passed on the command-line:

(defun VedaRunScriptArgs (@optional n) ...)

If n is nil or missing, that function returns a list of all the script arguments:

(VedaRunScriptArgs)
;=> ("arg1" "arg2" ...)

Otherwise, n is interpreted as the 1-based index of the argument to retrieve:

(VedaRunScriptArgs 3)
;=> "arg3", or nil

As a special case, a n of zero provides access to the script name:

(VedaRunScriptArgs 0)
;=> "/path/to/script"

The VedaRun* namespace prefix is reserved for future extensions.

cf. EXAMPLES section below.

EXAMPLES

Given the following hello.ilx file:

#!/usr/bin/env veda-run-ilx
;; @language scheme

;; Defining a "main" function is considered good style.
(defun Hello (args)
  (let ((who (if args
                 (buildString args ", ")
                 "World")))
    (printf "Hello, %s!\n" who)))

;; Go.
(Hello (VedaRunScriptArgs))

one can do:

$ chmod 755 hello.ilx
$ ./hello.ilx
Hello, World!
$ ./hello.ilx Coyote
Hello, Coyote!
$ ./hello.ilx "Wile E. Coyote" "Road Runner"
Hello, Wile E. Coyote, Road Runner!

SEE ALSO

Crosstwine Veda on the Web