I've been digging through stackexchange for the past few days and I've found bits and pieces of what I'm trying to accomplish, but I'm unsure how to put it all together...I'm trying to create a script that has curl calls to an API. This returns a whole bunch of xml which I want to then parse down to just certain values only. Overall, I want this script to make the call, parse the values / set them as a variable, and return(display) them.I may have found a working type solution, but is this practical? #!/bin/bashtest=$(curl -k --silent https://username:password@website.api.address?.full=true&name=devicename)test2=$(curl -k --silent https://username:password@website.api.address?.devicestatus&name=devicename)variable1=$grep -oPm1 (?<=<name>)[^<]+ <<< $test:)variable2=$grep -oPm1 (?<=<status>)[^<]+ <<< $test:)echo $variableecho $variable2[admin]>./scriptSwitchNameUPHere's the XML I'm trying to dig through:<?xml version=1.0 ?><queryResponse type=AccessPointDetails rootUrl=https://website/webacs/api/v1/data requestUrl=https://website/webacs/api/v1/data/AccessPointDetails?.full=true&amp;name=devicename responseType=listEntityInstances count=1 first=0 last=0>  <entity url=https://website/webacs/api/v1/data/AccessPointDetails/14008947223 type=AccessPointDetails dtoType=accessPointDetailsDTO>    <accessPointDetailsDTO id=14008947223 displayName=14008947223>      <clientCount>6</clientCount>      <clientCount_2_4GHz>0</clientCount_2_4GHz>      <clientCount_5GHz>6</clientCount_5GHz>      <ipAddress>172.16.83.5</ipAddress>      <name>devicename</name>      <unifiedApInfo>        ......      </unifiedApInfo>      <upTime>609857</upTime>    </accessPointDetailsDTO>  </entity></queryResponse><?xml version=1.0 ?><queryResponse type=AccessPointDetails rootUrl=https://website/webacs/api/v1/data requestUrl=https://website/webacs/api/v1/data/AccessPointDetails?.full=true&amp;name=devicename responseType=listEntityInstances count=1 first=0 last=0>  <entity url=https://website/webacs/api/v1/data/AccessPointDetails/14008947223 type=AccessPointDetails dtoType=accessPointDetailsDTO>    <accessPointDetailsDTO id=14008947223 displayName=14008947223>      <name>devicename</name>      <status>UP</status>      <unifiedApInfo>        ......      </unifiedApInfo>    </accessPointDetailsDTO>  </entity></queryResponse>
Parse xml returned from curl within a bash script
bash;scripting;curl;xml