Curl-ing to extension attribute not working in Big Sur?

jrdn_
New Contributor

Hello fellow Jamf Admins,

I'm trying to GET a specific extension attribute and only output the specific result using the following script:

curl -sku $jssUser:$jssPass -H "accept: text/xml" xml=$(https://$orgName.jamfcloud.com/JSSResource/computers/id/$jamfID/subset/extension_attributes)
deviceType=$(echo $xml | xpath "//*[id=$deviceTypeEAID]/value/text()")

This command works perfectly when running it in Catalina and below, but for some reason when I run it in Big Sur I get the following error:

Script result: Usage:
/usr/bin/xpath5.28 [options] -e query [-e query...] [filename...]

If no filenames are given, supply XML on STDIN. You must provide at
least one query. Each supplementary query is done in order, the
previous query giving the context of the next one.

Options:

-q quiet, only output the resulting PATH.
-s suffix, use suffix instead of linefeed.
-p postfix, use prefix instead of nothing.
-n Don't use an external DTD.

I'm pretty junior when it comes to scripting, and I'm not sure what the error is referring to or why it only works in older OS X versions. . Any chance someone can walk me through this? Please and Thank you!

1 ACCEPTED SOLUTION

sdagley
Esteemed Contributor II
3 REPLIES 3

sdagley
Esteemed Contributor II

@jordan.maramag Take a look at this post which shows how to deal with the xpath changes in Big Sur: https://www.jamf.com/jamf-nation/discussions/37011/request-for-a-renaming-script#responseChild210111

jrdn_
New Contributor

Thanks @sdagley, I was able to resolve the issue after reading the article!

JVSanchez
New Contributor II

https://scriptingosx.com/2020/10/dealing-with-xpath-changes-in-big-sur/
xpath() { # the xpath tool changes in Big Sur if [[ $(sw_vers -buildVersion) > "20A" ]]; then /usr/bin/xpath -e "$@" else /usr/bin/xpath "$@" fi
}