Quantcast
Viewing all articles
Browse latest Browse all 10

Answer by Bimal Poudel for Parse XML to get node value in bash script?

You can make use of php command line interface coding in bash scripts to handle several complex scripts that actually span over multiple lines of coding. First, try to make your solution using PHP scripts, and then later on pass the parameters using CLI mode. Thus, you can get control over superb usages of XML parsers.

The environment seems that you can use PHP in client mode via ssh/shell access.

php -f yourxmlparser.php

Now, do all the things within your php file. Make use of command line parameters it can take.

You can even assign that return values to Shell environment to continue rest of your shell scripts.

And the other way is to use |grep option to match your required value within the xml file, if you are pretty sure of the structure of your xml file that does not change over time.


Viewing all articles
Browse latest Browse all 10

Trending Articles