How to assign xml node value to bash script variable -
i have valid xml file contains like:
<configsettings> <pairs> <p> <name>installdirectory</name> <val>/library/application support/home</val> </p>
... other pairs follow ...
on command line following works return correct <val>
string:
echo 'cat /configuresdk/configsettings/pairs/p[name="installdirectory"]/val/text()' | xmllint --shell initsdk.xml | grep -v "^/ >"
however, when try assign result variable within script, e.g.,
abc='cat /configuresdk/configsettings/pairs/p[name="installdirectory"]/val/text()' | xmllint --shell initsdk.xml | grep -v "^/ >"
then try
echo $abc
nothing printed.
i'm sure i'm missing simple, have tried many variations no avail.
thanks help.
use export
, $(...)
capturing output of command.
$ export a=$(echo hello) $ echo $a hello
Comments
Post a Comment