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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -