According to the Xidel documentation, I'm under the impression that the following code should work, and should produce an output that I can access in the BASH variable "bar":
#!/bin/bash
TEST='<foo><bar>test</bar></foo>'
xidel $TEST -e 'bar:=//bar' --output-format=bash
echo "Result: ${bar}"
However, the output I get when executing this code is:
**** Processing: data:,<foo><bar>test</bar></foo> ****
** Current variable state: **
bar='test'
Result:
It's strange because Xidel is clearly printing its current variable state to include my variable...so I must not be accessing it correctly? How do I access it now, if not with $bar
Edit:
Gordon Davisson's comment below is correct - I misread the documentation. Working code looks like this:
#!/bin/bash
TEST='<foo><bar>test</bar></foo>'
eval $(xidel $TEST -e 'bar:=//bar' --output-format=bash)
echo "Result: ${bar}"
Is this what you want to achieve ?