
OMake also includes a standalone command-line interpreter osh that can be used as an
interactive shell. The shell uses the same syntax, and provides the same features on all platforms
omake supports, including Win32.
On startup, osh reads the file ~/.oshrc
if it exists. The syntax of this file is the
same as an OMakefile. The following additional variables are significant.
The prompt
variable specifies the command-line prompt.
It can be a simple string.
prompt = osh>
Or you may choose to define it as a function of no arguments.
prompt() =
return $"<$(USER):$(HOST) $(homename $(CWD))>"
An example of the latter prompt is as follows.
<jyh:kenai.yapper.org ~>cd links/omake
<jyh:kenai.yapper.org ~/links/omake>
If the ignoreeof
is true
, then osh
will not exit on
a terminal end-of-file (usually ^D
on Unix systems).
Command aliases are defined by adding functions to the Shell.
object. The following alias
adds the -AF
option to the ls
command.
Shell. +=
ls(argv) =
"ls" -AF $(argv)
Quoted commands do not undergo alias expansion. The quotation "ls"
prevents the alias from
being recursive.
13.3 Interactive syntax
The interactive syntax in osh
is the same as the syntax of an OMakefile
, with one
exception in regard to indentation. The line before an indented block must have a colon at the end
of the line. A block is terminated with a .
on a line by itself, or ^D
. In the
following example, the first line if true
has no body, because there is no colon.
# The following if has no body
osh>if true
# The following if has a body
osh>if true:
if> if true:
if> println(Hello world)
if> .
Hello world
Note that osh
makes some effort to modify the prompt while in an indented body, and it
auto-indents the text.
The colon signifier is also allowed in files, although it is not required.