# .bashrc-xml # run different implementation to select data from XML file per XPath expression # $1 ... XPath expr # $2 ... file xml-xpath() { [ $# -ne 2 ] && int-usage "XPath" "XML" && return local clrstart=$(test -t && echo -e '\x1b[1;34m' || echo -n) local clrmiddle=$(test -t && echo -e '\x1b[1;30m' || echo -n) local clrend=$(test -t && echo -e '\x1b[0m' || echo -n) # yum install libxml2 echo -e "\n${clrstart}--- xmllint: ${clrmiddle}xmllint --noout --xpath '$1' '$2'${clrstart} ---${clrend}" xmllint --noout --xpath "$1" "$2" # yum install xmlstarlet echo -e "\n${clrstart}--- XMLStarlet: ${clrmiddle}xmlstarlet sel -t -v '$1' '$2'${clrstart} ---${clrend}" xmlstarlet sel -t -v "$1" "$2" # yum install xqilla echo -e "\n${clrstart}--- XQilla: ${clrmiddle}xqilla -P <(echo '$1') -i '$2'${clrstart} ---${clrend}" xqilla -P <(echo "$1") -i "$2" }