Skip to main content
Solved

Using exclamation marks within jamfHelper messages


lastdanstanding
Forum|alt.badge.img+10

Is it possible to use exclamation messages in jamfHelper messages? The message I would like to create would say something like:

Heading:

Howdy Partner!

Description:

A multi-line message goes here. It contains apostrophes, like this: ' so I can't easily use single quotes to contain the description!

I had hoped the code below would work, but alas, the exclamation marks are breaking the formatting. And, if I escape the exclamation marks, the backslashes wind up in the dialog. See attached images for reference.

Anybody have experience with the proper way to format/escape this?

Thanks!

JAMFHELPER="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"

"$JAMFHELPER" 
-windowType hud 
-lockHUD 
-heading "Howdy Partner!" 
-description "A multi-line message goes here.

It contains apostrophes, like this: '

so I can't easily use single quotes to contain the description!" 
-button1 "Okay" 
-defaultButton 1 
-startlaunchd


Best answer by mm2270

I copied and pasted your above script text verbatim into a file, added a #!/bin/sh to the top and ran it and it worked perfectly for me. So... I'm not sure why you're seeing an issue with it. It seems to work. Here's proof. Again, this is your exact text as posted above, no modifications other than making into a proper shell script with a shebang.

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

4 replies

Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • February 4, 2016

You have a single quote and double quote on the Howdy line that is confusing me. Using single quotes should work as expect.

#!/bin/sh JAMFHELPER='/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper' "$JAMFHELPER" -windowType hud -lockHUD -heading 'Howdy Partner!' -description "A multi-line message goes here. It contains apostrophes, like this: ' "

lastdanstanding
Forum|alt.badge.img+10

Oops that was a typo, now fixed.

The problem is that I am using single quotes within the description, and the escaping has proven difficult.

However as I type this I am wondering if I should be using the utf-8 character for apostrophe instead. I'll try that when I'm back at the office.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • Answer
  • February 5, 2016

I copied and pasted your above script text verbatim into a file, added a #!/bin/sh to the top and ran it and it worked perfectly for me. So... I'm not sure why you're seeing an issue with it. It seems to work. Here's proof. Again, this is your exact text as posted above, no modifications other than making into a proper shell script with a shebang.


lastdanstanding
Forum|alt.badge.img+10

Wow, you are of course correct @mm2270. I was so busy trying to get it to work in an interactive shell for testing, that I never actually ran the script.

Asking around people smarter than me, it sounds like the different behavior has to do with history processing in your shell, vs. how it's interpreted in a script.

Computers eh?

Thanks for steering me straight!


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