Let's first consider a simple example of XML input to the
Here's how it must look like in the CLI variant:
$ exp_plesk_domain del filter id=3
As it can be seen a default behavior for the CLI input parser is to get the next argument and put it inside the previous one (the 'packet' node is not needed here, it will be inserted automatically). If an argument contains the '=' sign a node gets assigned a text data value, which comes directly after the '=' sign.
Here is one more example of XML input for
That is how it looks like in CLI input:
$ exp_expand_config person add login=nobody email=nobody@localhost \
name='Nobody person' password=setup roles role_id=1
As you can see, if a node gets its text data, it's considered a terminal one (i.e. having no children). Thus we can just enlist the sibling terminal nodes. In case we want to put 'roles' node as the first child of the 'add' node, the CLI input will look like this:
$ exp_expand_config person add roles [ role_id=1 ] \
email=nobody@localhost name='Nobody person' \
Note the square brackets. They enclose all the children for a preceding node (in our example, the node 'role_id'). And the XML packet in this case will look as follows:
After a square bracket gets closed, the siblings for that node follow. You may say that this package is rather simple and there is no difference whether to use square brackets or not. But when you read this section further and consider more complicated examples, you will see how useful the square brackets are.
Note: Each bracket must be separated with at least one space from the arguments on both sides. This restriction stems from the method the shell uses to build the command line arguments list for a program. It just drops quotes.
Thus one can't tell these two structures one from another:
$ exp_expand_config person add name='Some weird [person]'
$ exp_expand_config person add name='Some weird '[person]
Both of them look identical from the shell's point of view. By the way, that's why an error is generated for such "obvious" shell commands:
$ [-n "foo" ] && echo OK
Note: Please remember: no spaces before or after the equation sign ('=').