Skip to main content
Question

Create Script to run as current user and store on Users Desktop

  • September 18, 2019
  • 1 reply
  • 0 views

Forum|alt.badge.img+4

I've researched these forums and tried to adjust a script to my needs but still getting an error when running it.

Main Goal: To get a savable list of 32-bit applications to the users desktop.

CURRENT SCRIPT:

!/bin/bash

sudo system_profiler SPApplicationsDataType | grep -B 6 -A 2 "(Intel): No" > /Users/$USER/Downloads/32BitApps.txt

I've tried setting $USER as a custom variable as well, same result. (syntax was username = $USER)

Any information would be appreciated. I'm somewhat new to shell scripting so if possible, so please take that into consideration.

1 reply

Forum|alt.badge.img+11
  • Valued Contributor
  • 142 replies
  • September 19, 2019

Try this... Also JAMF runs as root so the sudo shouldn't be needed.

!/bin/bash

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

system_profiler SPApplicationsDataType | grep -B 6 -A 2 "(Intel): No" > /Users/$loggedInUser/Desktop/32BitApps.txt

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings