Additions:
command 2"">>"" file
Deletions:
Additions:
command 2>> file
Stderr Output for command is appended to file "file"
Stderr Output for command is appended to file "file"
Additions:
Input and output can be explicitly bound to a [[NamedPorts Named Port]]. Named ports are specified by preceding the redirection symbol with (port). There are 3 predefined named ports, "input" , "output" , "error"
Deletions:
Additions:
====Variable Redirection====
A variable can be used for input or output redirection. The syntax is **{variable}** wherever a file would be used.
Example the following two commands are equivalent and send the result of xls into the variable "doc".
Variables can be //Appended//. This will turn a non-sequenced variable into a sequenced variable.
The one exception is that if the variable is initially empty, or contains a single atomic value, AND the output of the command is text then the appending works like appending to a file, that is the strings are concatenated.
====Port Redirection====
Input and output can be explicitly bound to [[NamedPorts Named Port]]. Named ports are specified by preceding the redirection symbol with (port). There are 3 predefined named ports, "input" , "output" , "error"
For example to bind the standard input port to "file.xml" and the port named "alternate" to "alternate.xml"
$ command (alternate)<alternate.xml <file.xml
The syntax 2< is synonymous with (error)< and 2> is synonymous with (error)>
For example, the following 2 commands are equivalent.
$ command 2>error.txt
$ command (error)>error.txt
A variable can be used for input or output redirection. The syntax is **{variable}** wherever a file would be used.
Example the following two commands are equivalent and send the result of xls into the variable "doc".
Variables can be //Appended//. This will turn a non-sequenced variable into a sequenced variable.
The one exception is that if the variable is initially empty, or contains a single atomic value, AND the output of the command is text then the appending works like appending to a file, that is the strings are concatenated.
====Port Redirection====
Input and output can be explicitly bound to [[NamedPorts Named Port]]. Named ports are specified by preceding the redirection symbol with (port). There are 3 predefined named ports, "input" , "output" , "error"
For example to bind the standard input port to "file.xml" and the port named "alternate" to "alternate.xml"
$ command (alternate)<alternate.xml <file.xml
The syntax 2< is synonymous with (error)< and 2> is synonymous with (error)>
For example, the following 2 commands are equivalent.
$ command 2>error.txt
$ command (error)>error.txt
Deletions:
A variable can be used for input or output redirection. This is called a "Port".
the syntax is {variable} wherever a file would be used.
Example the following two commands are equivilent
Ports can be //Appended//. This will turn a non-sequenced variable into a sequenced variable.
The one exception is that if the variable is initially empty, or contains a single atomic value,
AND the output of the command is text then the appending works like appending to a file,
that is the strings are concatenated.
Additions:
IO can be redirected as per the unix shells (sh) with "> file" , """>>""file" "< file" , "2> file". Redirection to variables and named ports, "Here Documents" and both text and XML documents are supported.
Deletions:
Also Here Documents are supported for both text and XML documents.
Additions:
command "">>"" file
Deletions:
Additions:
command >> file
Appends the output of command to file, creating file if it does not already exist.
Appends the output of command to file, creating file if it does not already exist.
Additions:
IO can be redirected as per the unix shells (sh) with "> file" , """>>""file" "< file" , "2> file".
Deletions:
Additions:
IO can be redirected as per the unix shells (sh) with "> file" , """%gt;%gt;""; file" "< file" , "2> file".
Deletions:
Additions:
IO can be redirected as per the unix shells (sh) with "> file" , """%gt;%gt""; file" "< file" , "2> file".
Deletions:
Additions:
IO can be redirected as per the unix shells (sh) with "> file" , "%gt;%gt; file" "< file" , "2> file".
Deletions:
Additions:
IO can be redirected as per the unix shells (sh) with "> file" , ">> file" "< file" , "2> file".
The one exception is that if the variable is initially empty, or contains a single atomic value,
AND the output of the command is text then the appending works like appending to a file,
that is the strings are concatenated.
Text concatenation works when text mode commands are used.
$ echo foo >{port}
$ echo bar >>{port}
$ echo $port
foobar
The one exception is that if the variable is initially empty, or contains a single atomic value,
AND the output of the command is text then the appending works like appending to a file,
that is the strings are concatenated.
Text concatenation works when text mode commands are used.
$ echo foo >{port}
$ echo bar >>{port}
$ echo $port
foobar
Deletions:
Additions:
====URL Input====
URL's can be used for input redirection any place a file is used.
For example
$ xcat < http://test.xmlsh.org/data/books.xml
Also any Internal or Builtin commands that take filenames will take URL's for input files.
For example the above can be rewritten without using redirection
$ xcat http://test.xmlsh.org/data/books.xml
In both cases, the Base URI of the resulting document is preserved.
Note that URL redirection can only be used for input, not for output at this time.
====Ports====
A variable can be used for input or output redirection. This is called a "Port".
the syntax is {variable} wherever a file would be used.
Example the following two commands are equivilent
$ xls >{doc}
$ xls | xread doc
And so are the following
$ xcat <{doc}
$ echo $doc | xcat
Ports can be //Appended//. This will turn a non-sequenced variable into a sequenced variable.
Example
$ xls >{doc}
$ xls >>{doc}
Now $doc is a sequence of 2 documents. The following would produce equivilent results
$ xls | xread doc
$ doc=<[$doc,$doc]>
URL's can be used for input redirection any place a file is used.
For example
$ xcat < http://test.xmlsh.org/data/books.xml
Also any Internal or Builtin commands that take filenames will take URL's for input files.
For example the above can be rewritten without using redirection
$ xcat http://test.xmlsh.org/data/books.xml
In both cases, the Base URI of the resulting document is preserved.
Note that URL redirection can only be used for input, not for output at this time.
====Ports====
A variable can be used for input or output redirection. This is called a "Port".
the syntax is {variable} wherever a file would be used.
Example the following two commands are equivilent
$ xls >{doc}
$ xls | xread doc
And so are the following
$ xcat <{doc}
$ echo $doc | xcat
Ports can be //Appended//. This will turn a non-sequenced variable into a sequenced variable.
Example
$ xls >{doc}
$ xls >>{doc}
Now $doc is a sequence of 2 documents. The following would produce equivilent results
$ xls | xread doc
$ doc=<[$doc,$doc]>
Additions:
=====Here Documents=====
As per the unix shells, "Here Documents" are supported.
A "here Document" is data embedded directly in the script or from the terminal which becomes the standard input of a command.
The syntax is:
%%
command <<EOF
Some Text
Here until the magic "EOF" is found
on a line by its own
EOF
%%
The tag "EOF" can be any string. Here documents work as well for text as xml documents.
For example:
%%
xread doc <<EOF
<foo>
bar
</foo>
EOF
%%
As per the unix shells, "Here Documents" are supported.
A "here Document" is data embedded directly in the script or from the terminal which becomes the standard input of a command.
The syntax is:
%%
command <<EOF
Some Text
Here until the magic "EOF" is found
on a line by its own
EOF
%%
The tag "EOF" can be any string. Here documents work as well for text as xml documents.
For example:
%%
xread doc <<EOF
<foo>
bar
</foo>
EOF
%%
Additions:
----
See Also [[BasicSyntax]]
See Also [[BasicSyntax]]