Script Help for Extenstion Attribute to collect String

perweilerg
New Contributor III

I am trying to collect a string from the OEAO plist. The script I wrote works via ARD, but does not work as an EA in Casper. Any ideas as to what I am doing wrong? Is there a better way to collect the string for the destinationFolder Key?

#!/bin/sh

loggedInUser=/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'

/usr/libexec/PlistBuddy -c "print :destinationFolder" /Users/$loggedInUser/Library/Preferences/com.softhing.oeao3.plist

Thanks!

1 ACCEPTED SOLUTION

brad
Contributor

For extension attributes you will need to put the output in between results tags.

echo "<result>$result</result>"

So something like this:

#!/bin/sh

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

destinationFolder=`/usr/libexec/PlistBuddy -c "print :destinationFolder" /Users/$loggedInUser/Library/Preferences/com.softhing.oeao3.plist`

echo "<result>$destinationFolder</result>"

Good luck!

View solution in original post

2 REPLIES 2

brad
Contributor

For extension attributes you will need to put the output in between results tags.

echo "<result>$result</result>"

So something like this:

#!/bin/sh

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

destinationFolder=`/usr/libexec/PlistBuddy -c "print :destinationFolder" /Users/$loggedInUser/Library/Preferences/com.softhing.oeao3.plist`

echo "<result>$destinationFolder</result>"

Good luck!

perweilerg
New Contributor III

That worked. Thank you!!