![]() Usage: /System/Library/Frameworks/amework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python. Script result: Argument expected for the -c option I am trying the above for adobe or citrix brew from JAMF and i continue to fails with the below Sudo -u $loggedInUser 'brew install wget' LoggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCop圜onsoleUser import sys username = (SCDynamicStoreCop圜onsoleUser(None, None, None) or ) username = ] (username + " Using the Apple method, your script would look like: #!/bin/sh ![]() ![]() The Apple approved way is documented in post here: Get Currently Logged In User loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCop圜onsoleUser import sys username = (SCDynamicStoreCop圜onsoleUser(None, None, None) or ) username = ] (username + " Instead, use one of the many ways you can find on here to find the logged in user, like: currentUser=`/usr/bin/last -1 -t console | awk ''` The $3 variable is only populated during a login, I believe, so you would not be able to use that variable if the user is already logged in.
0 Comments
Leave a Reply. |