Skip to main content
Solved

Simple Bash script


Forum|alt.badge.img+2

I have a configuration profile that adds our VPN configuration. I then have a policy that kicks off this simple bash script. 

open “/System/Library/CoreServices/Menu Extras/vpn.menu” 

All this does is check the box for "Show VPN status in the menu bar"

This is the error that I'm getting.

Script result: The files /“/System/Library/CoreServices/Menu and /Extras/vpn.menu” do not exist. 

When I run the command in the terminal it completes successfully.

Best answer by sdagley

Did you really use “ (curly double quotes) instead of " (straight double quotes)? If so change them all to straight quotes.

View original
Did this topic help you find an answer to your question?

5 replies

AJPinto
Forum|alt.badge.img+26
  • Legendary Contributor
  • 2710 replies
  • February 23, 2024

On my device I can't even run that command in terminal, I get "The files /Users/UserID/“/System/Library/CoreServices/Menu and /Users/UserID/Extras/vpn.menu” do not exist." I believe core services is a symbolic link directory, you will need to locate the original path. 

 

lrwxr-xr-x   1 root  wheel       90 Feb  2 11:19 coreservicesd -> ../Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Support/coreservicesd


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3532 replies
  • Answer
  • February 23, 2024

Did you really use “ (curly double quotes) instead of " (straight double quotes)? If so change them all to straight quotes.


talkingmoose
Forum|alt.badge.img+36
  • Legendary Contributor
  • 1900 replies
  • February 23, 2024

I think the problem is that you're trying to run something by command line that opens an app. Jamf Pro runs commands as root, which means you're trying to open the app as root. But root isn't logged in.

Add a couple lines to the beginning to get the current user. Then use sudo or su to run the open command as that user.


Forum|alt.badge.img+2
  • Author
  • New Contributor
  • 1 reply
  • February 23, 2024
sdagley wrote:

Did you really use “ (curly double quotes) instead of " (straight double quotes)? If so change them all to straight quotes.


That was it. Thank you.


howie_isaacks
Forum|alt.badge.img+23
  • Esteemed Contributor
  • 772 replies
  • February 23, 2024
sdagley wrote:

Did you really use “ (curly double quotes) instead of " (straight double quotes)? If so change them all to straight quotes.


I write all of my scripts in BBEdit and sometimes in CodeRunner. I actually never gave this any thought... curly vs. straight quotes. I figured the style of the quotes was controlled by the font they're typed in.


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