======Basic Usage====== =====Invocation===== After installation is complete, you can start xmlsh by simply typing "xmlsh". This will run xmlsh in interactive mode. You can use xmlsh prety much like the unix shell(s). You will be prompted with a "$" %%(shrell) C:\p4dell\DEI\xmlsh\win32>xmlsh $ %% To run a xmlsh script pass the script filename as the first argument followed by the script arguments. %%(shell) C:\p4dell\DEI\xmlsh\test>xmlsh run_tests.xsh running tests in core Running test core_andor.xsh Running test core_args.xsh Running test core_brace.xsh Running test core_case.xsh Running test core_for.xsh Running test core_here.xsh Running test core_if.xsh Running test core_subshell.xsh Running test core_vars.xsh Running test core_while.xsh running tests in builtin Running test builtin_read.xsh %% =====Basic Syntax===== xmlsh accepts the same core syntax as sh. Statements such as for, while, do, case are fully implemented. Similarly pipelines to either internal or external commands. For example: %%(shell) $ for var in a b c ; do echo $var done a b c %% Just as sh, the PATH variable specifies the directories to search for external commands so right 'out of the box' you can run commands the same was as with sh. For example, assuming "ls" and "grep" exist in your path the following works as expected %%(shell) ls | grep foo %% =====Variables===== xmlsh supports both string and XML variables. See [[Variables]] for more details. Variable types are dynamic, they take on the type of the last assigned expression. ====String Variables==== xmlsh supports simple string variables and variable substitution like sh. %%(shell) $ V1="string" $ V2="another $V1" $ echo $V2 another string %% ====XML Variables==== xmlsh also supports XML expressions and variables. See [[XmlExpressions XML Expressions]] for details on XML Expressions. This example creates an XML variable "x" and assigns it am xml sequence %%(shell) $ x=<[1,"hi",bar,4]> $ for a in $x ; do echo $a done 1 hi bar 4 %% ===Operating System Calls=== In Linux or Windows command shells, you run commands at the prompt. E.g. to execute a Java program, run a C program or anything else. From within an xmlsh script you can do just the same. Assume you have a Java program, in XXX.jar that you want to run and collect the output. %% op=$(java -jar XXX.jar -i inputFile.txt -t 10) %% That runs the program, returns the output of the program and stores it in the $op variable ready for further use. In this way, **anything** you can do from the command line you can do from within an xmlsh script ====Details==== For details on xmlsh invocation and parameters see [[CommandXmlsh xmlsh command]] ====XML Serialization and Parsing==== For details on the XML serialization and parsing options see [[Serialization]]