Revision [1697]

Last edited on 2011-03-16 04:44:17 by DavidLee
Additions:
**until list ; do list ; done **
Until command is the same as a while command except that the loop terminates when the check evaluates to true instead of false.


Revision [1552]

Edited on 2010-11-18 08:10:30 by DavidLee
Additions:
See [[SyntaxFunction Function Syntax]] for details


Revision [1548]

Edited on 2010-11-18 08:05:06 by DavidLee
Additions:
===Function Call===
User defined functions can be invoked with either the command or the function call syntax.
Builtin [[Functions functions]] and module defined functions may only be called with the function call syntax
name( [arg ...])
This is an *expression* and may be used anywhere a word may be used, including variable assignment.
Arguments are evaluated exactly like command arguments (blankspace seperated , not comma ","). Variable expansion and wildcard expansion occur in the argument list exactly like command invocaton. The resulting arguments are passed to the function, and the [[CommandReturn return]] value is substituted.


Revision [1400]

Edited on 2010-05-13 09:11:40 by DavidLee
Additions:
a=$(echo This is text)
Sets the value of variable "a" to "This is Text
Legacy "backtick" syntax is also supported.
a=`echo This is text`
Note that the $( cmd ) syntax can nest but the `cmd` cannot nest.


Revision [1399]

Edited on 2010-05-13 09:09:10 by DavidLee
Additions:
$(cmd) cmd is executed and its output is is substituted with newlines turned into word seperators
`cmd` Same as $(cmd)
Deletions:
$(cmd) cmd is executed and its output is is substituted with newlines turned into word seperators


Revision [1358]

Edited on 2010-05-04 10:18:46 by DavidLee
Additions:
A **simple-command** is a sequence of non-blank words separated by blanks. The first word specifies the name of the command to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command.
A **pipeline **is a sequence of one or more commands separated by |. The standard output of each command but the last is connected by a Pipe to the standard input of the next command. Each command is run as a separate thread (if builtin or internal) or as a separate process (if external). The shell waits for the last command to terminate.
A **list **is a sequence of one or more pipelines separated by ;, &, &&, or ""||"", and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ""||"". The symbols && and ""||"" also have equal precedence.
A **command **is either a** simple-command **or one of the following.
Deletions:
A simple-command is a sequence of non-blank words separated by blanks. The first word specifies the name of the command to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command.
A pipeline is a sequence of one or more commands separated by |. The standard output of each command but the last is connected by a Pipe to the standard input of the next command. Each command is run as a separate thread (if builtin or internal) or as a separate process (if external). The shell waits for the last command to terminate.
A list is a sequence of one or more pipelines separated by ;, &, &&, or ""||"", and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ""||"". The symbols && and ""||"" also have equal precedence.
A command is either a simple-command or one of the following.


Revision [1350]

Edited on 2010-05-02 09:06:34 by DavidLee
Additions:
**name () { list;} **
**function name () { list ; } **
Execution of functions is described below (see Execution section). The { and } are unnecessary if the body of the function is a command as defined above, under Commands. See [[SyntaxFunction Functions]] for more detail on defining and executing functions.
Deletions:
**name () { list;} **
Execution of functions is described below (see Execution section). The { and } are unnecessary if the body of the function is a command as defined above, under Commands.


Revision [1167]

Edited on 2010-02-05 14:39:36 by DavidLee
Additions:
See [[XMLExpressions XML Expressions]] for details.


Revision [842]

Edited on 2009-11-06 12:27:34 by DavidLee
Additions:
The core syntax for xmlsh was derived from the open source [[http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html Shell Command Language]] syntax document. xmlsh does not follow this syntax exactly, but rather it was used as a basis.
Deletions:
The core syntax for xmlsh was derived from the open source [[http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
Shell Command Language]] syntax document. xmlsh does not follow this syntax exactly, but rather it was used as a basis.


Revision [806]

Edited on 2009-09-30 06:03:38 by DavidLee
Additions:
**try { list ; } catch word { list ; } **
**try { list ; } catch word { list ; } finally { list ; }**
Sets up a try/catch block for [[ExceptionHandling Exception Handling]]
**throw expression**
Throws an exception, caught by the catch clause in a try/catch block.
**if then else elif fi case esac for while until do eval done try catch finally throw { } **
Deletions:
**if then else elif fi case esac for while until do eval done { }**


Revision [804]

Edited on 2009-09-23 10:44:31 by DavidLee
Additions:
<[ xml ]> specifies explicit xml construction. The string between "<[" and "]>" is passed to xquery and the result is interpreted as an XML sequence. All variables in the shell environment are made available to the xquery as declared external variables.
Deletions:
<[ xml ]> specifies explicit xml construction. The string between "<[" and "]>" is passed to xquery and the result is interprested as an XML sequence. All variables in the shell environment are made available to the xquery as declared external variables.


Revision [803]

Edited on 2009-09-23 09:59:36 by DavidLee
Additions:
A list is a sequence of one or more pipelines separated by ;, &, &&, or ""||"", and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ""||"". The symbols && and ""||"" also have equal precedence.
The symbol && (""||"") causes the list following it to be executed only if the preceding pipeline returns a zero (non-zero) status.
Deletions:
A list is a sequence of one or more pipelines separated by ;, &, &&, or ""||"", and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ||. The symbols && and || also have equal precedence.
The symbol && (||) causes the list following it to be executed only if the preceding pipeline returns a zero (non-zero) status.


Revision [802]

Edited on 2009-09-23 09:58:53 by DavidLee
Additions:
A list is a sequence of one or more pipelines separated by ;, &, &&, or ""||"", and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ||. The symbols && and || also have equal precedence.
Deletions:
A list is a sequence of one or more pipelines separated by ;, &, &&, or ||, and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ||. The symbols && and || also have equal precedence.


Revision [801]

Edited on 2009-09-23 09:58:30 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
The core syntax for xmlsh was derived from the open source [[http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
Shell Command Language]] syntax document. xmlsh does not follow this syntax exactly, but rather it was used as a basis.
Deletions:
The core syntax for xmlsh was derived from the open source [[http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html Shell Command Language]] syntax document. xmlsh does not follow this syntax exactly, but rather it was used as a basis.


Revision [726]

Edited on 2009-09-09 10:31:53 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
The core syntax for xmlsh was derived from the open source [[http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html Shell Command Language]] syntax document. xmlsh does not follow this syntax exactly, but rather it was used as a basis.
Deletions:
The core syntax for xmlsh was derived from the open source [[http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
Shell Command Language]] syntax document. xmlsh does not follow this syntax exactly, but rather it was used as a basis.


Revision [684]

Edited on 2009-08-26 15:21:26 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Deletions:
"this" is block 'quotes'


Revision [683]

Edited on 2009-08-26 15:21:08 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
""<{{ }}>"" are block quotes. These are treated as single quotes but are useful to quote large text with unknown content. No expansion or interpretation of the contents, and the result is treated as one word with the ""<{{ and }}>"" removed.
Deletions:
<{{ }}> are block quotes. These are treated as single quotes but are useful to quote large text with unknown content. No expansion or interpretation of the contents, and the result is treated as one word with the "<{{" and "}}>" removed.


Revision [682]

Edited on 2009-08-26 15:18:57 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
===Quoting===
Single and double quotes are implemented similar to sh/bash/ksh. Text in single quotes ('text') is treated literally with no expansion and treated as one word. Text in double quotes ( "text") is variable expanded then treated as one word. Within double quotes the escape character backslash (\) can be used to remove special meaning from $ or double quotes (").
<{{ }}> are block quotes. These are treated as single quotes but are useful to quote large text with unknown content. No expansion or interpretation of the contents, and the result is treated as one word with the "<{{" and "}}>" removed.
example:
echo <{{
"this" is block 'quotes'
and can contain anything including < and { and even {{,
variable syntax like $variable is unexpanded.
}}>
produces
"this" is block 'quotes'
and can contain anything including < and { and even {{,
variable syntax like $variable is unexpanded.

<[ xml ]> specifies explicit xml construction. The string between "<[" and "]>" is passed to xquery and the result is interprested as an XML sequence. All variables in the shell environment are made available to the xquery as declared external variables.
Deletions:
<[ xml ]> specifies explicit xml construction. The string between "<[" and "]>" is passed to xquery and the result is interprested as an XML sequence. All variables in the shell environment are made available to the xquery as declared external variables.


Revision [513]

Edited on 2009-05-13 12:09:04 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
==Command execution==
Deletions:
Command execution


Revision [512]

Edited on 2009-05-13 12:06:18 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
===Command Substitution===
%%
a=foo.txt
%%
===XML Command Substitution===
Similar to Command Substitution, $<( command ) indicates a command which is executed and the output is parsed as an XML document.
Command is executed identically to the $(command) syntax except that the result is then parsed as an XML document and the result is an XML expression.
If the command is of the form $<(<file) then the file is read and parsed as an XML document. The resulting expression is of XML type.
%%
%%
===XML Namespaces===
Deletions:
=== Command Substitution===
**a=foo.txt
=== XML Command Substitution===
Similar to Command Substitution, $<( command ) indicates a command which
is executed and the output is parsed as an XML document.
Command is executed identically to the $(command) syntax except that the result
is then parsed as an XML document and the result is an XML expression.
If the command is of the form $<(<file) then the file is read, trailing newlines
stripped and the result is parsed as an XML document.
XML Namespaces


Revision [511]

Edited on 2009-05-13 12:03:39 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
===Variable Substitution===
===XML Substition===
<[ xml ]> specifies explicit xml construction. The string between "<[" and "]>" is passed to xquery and the result is interprested as an XML sequence. All variables in the shell environment are made available to the xquery as declared external variables.
=== Command Substitution===
The shell reads commands from the string between $( and ) and the standard output from these commands may
be used as all or part of a word. Trailing newlines from the standard output are removed.
No interpretation is done on the string before the string is read, except to remove backslashes (\) used to escape other
If the command is of the form $(<file) then the file is read, trailing newlines stripped and the result is a string containing the entire file.
**a=foo.txt
echo $(<$a)**
=== XML Command Substitution===
Deletions:
Variable Substitution
XML Substition
<[ xml ]> specifies explicit xml construction. The string between "<[" and "[>" is passed to xquery
and the result is interprested as an XML sequence. All variables in the shell environment are made
available to the xquery as declared external variables.
Command Substitution
The shell reads commands from the string between $( and )
and the standard output from these commands may
be used as all or part of a word. Trailing newlines from the
standard output are removed.
No interpretation is done on the string before the string is
read, except to remove backslashes (\) used to escape other
If the command is of the form $(<file) then the file is read, trailing newlines
stripped and the result is a string containing the entire file.
a=foo.txt
echo $(<$a)
XML Command Substitution


Revision [510]

Edited on 2009-05-13 12:01:59 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
**if then else elif fi case esac for while until do eval done { }**
===Comments Lines===
A word beginning with # causes that word and all the following characters up to a newline to be ignored.
=== Variables===
var=value
Note that there is no space before or after the = (or this will be treated as executing a command with arg1 = "=")
Deletions:
**if then else elif fi case esac for while until do eval
done { }**
Comments Lines
A word beginning with # causes that word and all the follow-
ing characters up to a newline to be ignored.
Variables
var = value


Revision [509]

Edited on 2009-05-13 12:00:20 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
A while command repeatedly executes the while list and, if the exit status of the last command in the list is zero, executes the do list; otherwise the loop terminates. If no commands in the do list are executed, then the while command returns a zero exit status; until may be used in place of while to negate the loop termination test.
**eval arg [args ...]**
Converts each argument a string and joins them with a space. The resulting string is passed to the parser and re-evaluated and executed in the current context.
**(list)**
Execute list in a sub-shell. Hence changes to the environment made within this subshell do not affect the parent shell.
**{ list;}**
list is executed in the current (that is, parent) shell. The { must be followed by a space.
**name () { list;} **
Define a function which is referenced by name. The body of the function is the list of commands between { and }. The { must be followed by a space.
Execution of functions is described below (see Execution section). The { and } are unnecessary if the body of the function is a command as defined above, under Commands.
**break**
The following words are only recognized as the first word of a command and when not quoted:
**if then else elif fi case esac for while until do eval
done { }**
Deletions:
A while command repeatedly executes the while list and,
if the exit status of the last command in the list is
zero, executes the do list; otherwise the loop terminates.
If no commands in the do list are executed,
then the while command returns a zero exit status;
until may be used in place of while to negate the loop
termination test.
eval arg [args ...]
Converts each argument a string and joins them with a space. The resulting string
is passed to the parser and re-evaluated and executed in the current context.
(list)
Execute list in a sub-shell.
Hence changes to the environment made within this subshell do not affect the parent shell.
{ list;}
list is executed in the current (that is, parent)
shell. The { must be followed by a space.
name () { list;}
Define a function which is referenced by name. The body of the function is the
list of commands between { and }. The { must be followed by a space. \
Execution of functions is described below (see Execution section).
The { and } are unnecessary if the body of the function
is a command as defined above, under Commands.
break
The following words are only recognized as the first word of
a command and when not quoted:
if then else elif fi case esac for while until do eval
done { }


Revision [508]

Edited on 2009-05-13 11:56:36 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
This is a synopsis of the supported syntax.
Deletions:
This is a synopsis of the supported syntax. Complete specifications (will be) provided in the future when the language is stabilized.


Revision [507]

Edited on 2009-05-13 11:56:19 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
A case command executes the list associated with the first pattern that matches word. The form of the patterns is the same as that used for file-name generation (see File Name Generation section), except that a slash, a leading dot, or a dot immediately following a slash need not be matched explicitly.
**if list ; then list ; [ elif list ; then list ; ] ... [ else list ; ] fi**
The list following if is executed and, if it returns a zero exit status, the list following the first then is executed. Otherwise, the list following elif is executed and, if its value is zero, the list following the next then is executed. Failing that, the else list is executed. If no else list or then list is executed, then the if command returns a zero exit status.
**while list ; do list ; done **
Deletions:
A case command executes the list associated with the
first pattern that matches word. The form of the pat-
terns is the same as that used for file-name generation
(see File Name Generation section), except that a slash,
a leading dot, or a dot immediately following a slash
need not be matched explicitly.
if list ; then list ; [ elif list ; then list ; ] ... [ else list ; ] fi
The list following if is executed and, if it returns a zero
exit status, the list following the first then is executed.
Otherwise, the list following elif is executed and, if its
value is zero, the list following the next then is executed.
Failing that, the else list is executed. If no else list or
then list is executed, then the if command returns a zero
exit status.
while list ; do list ; done


Revision [506]

Edited on 2009-05-13 11:55:00 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
A list is a sequence of one or more pipelines separated by ;, &, &&, or ||, and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ||. The symbols && and || also have equal precedence.
Each time a for command is executed, name is set to the next word taken from the in word list. If word is an XML sequence then it is expanded as seperate words. If in word ... is omitted, then the for command executes the do list once for each positional parameter that is set (see Parameter Substitution section below). Execution ends when there are no more words in the list.
**case word in [ pattern [ | pattern ] ) list ;; ] ... esac**
Deletions:
A list is a sequence of one or more pipelines separated by ;, &, &&, or ||, and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ||. The symbols && and || also have equal precedence.
Each time a for command is executed, name is set to the
next word taken from the in word list. If word is an XML sequence
then it is expanded as seperate words. If in word ... is
omitted, then the for command executes the do list once
for each positional parameter that is set (see Parameter
Substitution section below). Execution ends when there
are no more words in the list.
case word in [ pattern [ | pattern ] ) list ;; ] ... esac


Revision [505]

Edited on 2009-05-13 11:54:09 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
The command name is used to locate the command (builtin, nternal,external) .
A pipeline is a sequence of one or more commands separated by |. The standard output of each command but the last is connected by a Pipe to the standard input of the next command. Each command is run as a separate thread (if builtin or internal) or as a separate process (if external). The shell waits for the last command to terminate.
The exit status of a pipeline is the exit status of the last command in the pipeline.
A list is a sequence of one or more pipelines separated by ;, &, &&, or ||, and optionally terminated by ; or &. Of these four symbols, ; and & have equal precedence, which is lower than that of && and ||. The symbols && and || also have equal precedence.
A semicolon (;) causes sequential execution of the preceding pipeline, that is, the shell waits for the pipeline to finish before executing any commands following the semicolon. An ampersand (&) causes asynchronous execution of the preceding pipeline, that is, the shell does not wait for that pipeline to finish.
The symbol && (||) causes the list following it to be executed only if the preceding pipeline returns a zero (non-zero) status.
An arbitrary number of newlines may appear in a list, instead of semicolons, to delimit commands.
A command is either a simple-command or one of the following.
Unless otherwise stated, the value returned by a command is that of the last simple-command executed in the command.
**for name [ in word ... ] ; do list done**
Deletions:
The command name is used to locate the command (builtin, nternal,external) . The
value of a simple-command.
A pipeline is a sequence of one or more commands separated
by |. The standard output of each command but the last is
connected by a Pipe to the standard input of the next
command. Each command is run as a separate thread (if builtin or internal)
or as a seperate process (if external). The
shell waits for the last command to terminate. The exit
status of a pipeline is the exit status of the last command
in the pipeline.
A list is a sequence of one or more pipelines separated by
;, &, &&, or ||, and optionally terminated by ; or &. Of
these four symbols, ; and & have equal precedence, which is
lower than that of && and ||. The symbols && and || also
have equal precedence. A semicolon (;) causes sequential
execution of the preceding pipeline, that is, the shell
waits for the pipeline to finish before executing any com-
mands following the semicolon. An ampersand (&) causes asyn-
chronous execution of the preceding pipeline, that is, the
shell does not wait for that pipeline to finish. The symbol
&& (||) causes the list following it to be executed only if
the preceding pipeline returns a zero (non-zero) exit
status. An arbitrary number of newlines may appear in a
list, instead of semicolons, to delimit commands.
A command is either a simple-command or one of the follow-
ing. Unless otherwise stated, the value returned by a com-
mand is that of the last simple-command executed in the com-
mand.
for name [ in word ... ] ; do list done


Revision [504]

Edited on 2009-05-13 11:51:15 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
A simple-command is a sequence of non-blank words separated by blanks. The first word specifies the name of the command to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command.
Deletions:
~A simple-command is a sequence of non-blank words separated by blanks. The first word specifies the name of the command
to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command.


Revision [503]

Edited on 2009-05-13 11:49:58 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command.
Deletions:
~to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command.


Revision [502]

Edited on 2009-05-13 11:49:36 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
~A simple-command is a sequence of non-blank words separated by blanks. The first word specifies the name of the command
~to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command.
Deletions:
A simple-command is a sequence of non-blank words separated
by blanks. The first word specifies the name of the command
to be executed. Except as specified below, the remaining
words are passed as arguments to the invoked command.


Revision [403]

Edited on 2009-01-13 17:28:32 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
$! The thread id of the last background command executed with "cmd &"
Deletions:
$! unimplemented


Revision [402]

Edited on 2009-01-13 17:27:11 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
is then parsed as an XML document and the result is an XML expression.
If the command is of the form $<(<file) then the file is read, trailing newlines
stripped and the result is parsed as an XML document.
a=foo.xml
xecho -i $<(<$a)
Deletions:
is then parsed as an XML document and the result is an XML expression


Revision [401]

Edited on 2009-01-13 08:50:26 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
Similar to Command Substitution, $<( command ) indicates a command which
Command is executed identically to the $(command) syntax except that the result
is then parsed as an XML document and the result is an XML expression
Deletions:
Similar to Command Substitution, $<( command )> indicates a command which


Revision [400]

Edited on 2009-01-13 08:48:26 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
If the command is of the form $(<file) then the file is read, trailing newlines
stripped and the result is a string containing the entire file.
Variable expansion is done on "file" so that the following syntax works:
a=foo.txt
echo $(<$a)


Revision [290]

Edited on 2008-11-21 09:33:34 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
XML Command Substitution
XML Namespaces
Namespace support is manged with the [[Namespaces declare namespaces]] command.
Deletions:
XML Command Substitution
Namespaces
Namespace support is manged with the [Namespaces declare namespaces] command.


Revision [289]

Edited on 2008-11-21 09:32:52 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
Define a function which is referenced by name. The body of the function is the
list of commands between { and }. The { must be followed by a space. \
Execution of functions is described below (see Execution section).
Namespaces
Namespace support is manged with the [Namespaces declare namespaces] command.
Deletions:
Define a function which is referenced by name. The body
of the function is the list of commands between { and }.
The { must be followed by a space. Execution of func-
tions is described below (see Execution section).


Revision [287]

Edited on 2008-11-17 05:55:02 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:

eval arg [args ...]
Converts each argument a string and joins them with a space. The resulting string
is passed to the parser and re-evaluated and executed in the current context.
name () { list;}
if then else elif fi case esac for while until do eval
Deletions:
name () { list;} // NOT YET IMPLMENTED
if then else elif fi case esac for while until do


Revision [274]

Edited on 2008-07-22 04:24:17 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
while list ; do list ; done
break
terminates a for ,while, or until loop
Deletions:
while list do list done


Revision [244]

Edited on 2008-07-04 11:25:06 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
----
See Also [[BasicSyntax]]


Revision [237]

Edited on 2008-06-25 10:28:47 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
for name [ in word ... ] ; do list done
next word taken from the in word list. If word is an XML sequence
then it is expanded as seperate words. If in word ... is
Deletions:
for name [ in word ... ] do list done
next word taken from the in word list. If in word ... is


Revision [226]

Edited on 2008-06-12 17:07:09 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
$(cmd) cmd is executed and its output is is substituted with newlines turned into word seperators
$<(cmd) cmd is executed and the output parsed as an XML document and the result is an XML expression


Revision [75]

Edited on 2008-04-20 12:55:29 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
==== Commands ====
Command execution
Commands can be either builtin, internal, user defined or external commands.
Builtin commands are "special" in that they interact with the shell environment.
Internal commands implemented as a "convenience" in that they could be also implemented as
user defined commands. User defined commands are supported by creation of a jar containing
classes which implement the ICommand interface. External commands are any command (process)
outside of xmlsh. External commands are executed as seperate processes, all other commands are
executed with the JVM of xmlsh.
Deletions:
==== Commands====


Revision [74]

Edited on 2008-04-20 12:47:43 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
Variables
Variables can be set using the assigment statement
var = value
This initializes or overwrites a variable within the current shell environment.
Variables can be either String or XML types. XML types can be atomic, node, or sequence values.
( any value which can be returned from an xquery expression).
XML Variables are implicitly converted to strings when used in a string context.
Words are scanned for $ which indicates variable substition.
$name or ${name} is substituted for the value of the variable named "name".
$0 $2 ... $nnnnn is substituted for the positional paramter (note this differs from sh where n may be > 9)
There are several builtin variables
$? the exit code of the last command
$@ All positional parameters as if they were quoted. equal to "$1" "$2" "$3"
$$ The thread id of the current shell
$! unimplemented
$* All positional parameters unquoted. equal to $1 $2 $3 ...
$# The number of positional paramters
XML Substition
<[ xml ]> specifies explicit xml construction. The string between "<[" and "[>" is passed to xquery
and the result is interprested as an XML sequence. All variables in the shell environment are made
available to the xquery as declared external variables.
XML Command Substitution
Similar to Command Substitution, $<( command )> indicates a command which
is executed and the output is parsed as an XML document.
Deletions:
Words are scanned for $ which indicates variable substition.


Revision [73]

Edited on 2008-04-20 12:34:23 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
Variable Substitution
Words are scanned for $ which indicates variable substition.




Revision [72]

Edited on 2008-04-20 09:36:46 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
The list following if is executed and, if it returns a zero
exit status, the list following the first then is executed.
Otherwise, the list following elif is executed and, if its
value is zero, the list following the next then is executed.
Failing that, the else list is executed. If no else list or
then list is executed, then the if command returns a zero
exit status.
A while command repeatedly executes the while list and,
if the exit status of the last command in the list is
zero, executes the do list; otherwise the loop terminates.
If no commands in the do list are executed,
then the while command returns a zero exit status;
until may be used in place of while to negate the loop
Execute list in a sub-shell.
Hence changes to the environment made within this subshell do not affect the parent shell.
list is executed in the current (that is, parent)
name () { list;} // NOT YET IMPLMENTED
Define a function which is referenced by name. The body
of the function is the list of commands between { and }.
The { must be followed by a space. Execution of func-
tions is described below (see Execution section).
The { and } are unnecessary if the body of the function
is a command as defined above, under Commands.
Deletions:
The list following if is executed and, if it returns a zero
exit status, the list following the first then is executed.
Otherwise, the list following elif is executed and, if its
value is zero, the list following the next then is executed.
Failing that, the else list is executed. If no else list or
then list is executed, then the if command returns a zero
exit status.
A while command repeatedly
executes the while list and,
if the exit status of the
last command in the list is
zero, executes the do list;
otherwise the loop terminates.
If no commands in
the do list are executed,
then the while command
returns a zero exit status;
until may be used in place
of while to negate the loop
Execute list in a sub-shell.
list is executed in the
current (that is, parent)
name () { list;}
Define a function which is
referenced by name. The body
of the function is the list
of commands between { and }.
The { must be followed by a
space. Execution of func-
tions is described below
(see Execution section).
The { and } are unnecessary
if the body of the function
is a command as defined
above, under Commands.


Revision [71]

Edited on 2008-04-20 09:34:15 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
if list ; then list ; [ elif list ; then list ; ] ... [ else list ; ] fi

while list do list done
A while command repeatedly
executes the while list and,
if the exit status of the
last command in the list is
zero, executes the do list;
otherwise the loop terminates.
If no commands in
the do list are executed,
then the while command
returns a zero exit status;
until may be used in place
of while to negate the loop
termination test.
(list)
Execute list in a sub-shell.
{ list;}
list is executed in the
current (that is, parent)
shell. The { must be followed by a space.
name () { list;}
Define a function which is
referenced by name. The body
of the function is the list
of commands between { and }.
The { must be followed by a
space. Execution of func-
tions is described below
(see Execution section).
The { and } are unnecessary
if the body of the function
is a command as defined
above, under Commands.
The shell reads commands from the string between $( and )
and the standard output from these commands may
characters.
Deletions:
if list ; then list ; [ elif list ; then list ; ] ... [ else
list ; ] fi
while list do list done A while command repeatedly
executes the while list and,
if the exit status of the
last command in the list is
zero, executes the do list;
otherwise the loop ter-
minates. If no commands in
the do list are executed,
then the while command
returns a zero exit status;
until may be used in place
of while to negate the loop
termination test.
(list) Execute list in a sub-shell.
{ list;} list is executed in the
current (that is, parent)
shell. The { must be fol-
lowed by a space.
name () { list;} Define a function which is
referenced by name. The body
of the function is the list
of commands between { and }.
The { must be followed by a
space. Execution of func-
tions is described below
(see Execution section).
The { and } are unnecessary
if the body of the function
is a command as defined
above, under Commands.
The shell reads commands from the string between two grave
accents (``) and the standard output from these commands may
characters. Backslashes may be used to escape a grave accent
(`) or another backslash (\) and are removed before the com-
mand string is read. Escaping grave accents allows nested
command substitution. If the command substitution lies
within a pair of double quotes (" ...` ...` ... "), a
backslash used to escape a double quote (\") will be
removed; otherwise, it will be left intact.
If a backslash is used to escape a newline character (\new-
line), both the backslash and the newline are removed (see
the later section on Quoting). In addition, backslashes used
to escape dollar signs (\$) are removed. Since no parameter
substitution is done on the command string before it is
read, inserting a backslash to escape a dollar sign has no
effect. Backslashes that precede characters other than \, `,
", newline, and $ are left intact when the command string is
read.


Revision [70]

Edited on 2008-04-20 09:29:11 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
A simple-command is a sequence of non-blank words separated
by blanks. The first word specifies the name of the command
to be executed. Except as specified below, the remaining
words are passed as arguments to the invoked command.
The command name is used to locate the command (builtin, nternal,external) . The
command. Each command is run as a separate thread (if builtin or internal)
or as a seperate process (if external). The
these four symbols, ; and & have equal precedence, which is
Deletions:
A simple-command is a sequence of non-blank words separated
by blanks. The first word specifies the name of the command
to be executed. Except as specified below, the remaining
words are passed as arguments to the invoked command. The command name is used to locate the command (builtin, internal,external) . The
command. Each command is run as a separate thread (if builtin or internal) or as a seperate process (if external). The
these four symbols, ; and & have equal precedence, which is


Revision [69]

Edited on 2008-04-20 09:26:33 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Additions:
A simple-command is a sequence of non-blank words separated
by blanks. The first word specifies the name of the command
to be executed. Except as specified below, the remaining
Deletions:
A simple-command is a sequence of non-blank words separated
by blanks. The first word specifies the name of the command
to be executed. Except as specified below, the remaining


Revision [68]

The oldest known version of this page was created on 2008-04-20 09:26:05 by DavidLee [Reverting last edit by DavidLee [726] to previous version [684]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki