Using exclamation marks within jamfHelper messages

lastdanstanding
New Contributor III

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

b25eb53ff0404a6e9e8931d7a998a9e5
c4626e0a75454b699bc3c1068dfc898a

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

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.

c6447c142e3346f397c595af404d1d4a

View solution in original post

4 REPLIES 4

thoule
Valued Contributor II

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
New Contributor III

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
Legendary Contributor III

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.

c6447c142e3346f397c595af404d1d4a

lastdanstanding
New Contributor III

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!