I'm using FreeBSD server, where is no bash, how can I save command in an array?
Ive got command, which works grep '<description' amitOrServer.xml | cut -f2 -d">" | cut -f1 -d"<"
Im trying to save variables in <description />
from xml file.
XML file looks like this:
<amitOrServer>
<item>
<title>AMIT</title>
<description>DISABLE</description>
</item>
<item>
<title>GPS</title>
<description>DISABLE</description>
</item>
</amitOrServer>
I need to save DISABLE parameters in the variable to work with them later in the shell script.
a script where I save parameters in variables.
#!/bin/sh
chosenOne=( $(grep '<description' amitOrServer.xml | cut -f2 -d">" | cut -f1 -d"<") )
amit= "$chosenOne[$1]" #"ENABLE"
gps= "$chosenOne[$2]" #"DISABLE"
I've got error like Syntax error: word unexpected (expecting ")") Can anybody help me, how can I save these parameters from XML file in the array?