Posted on 02-04-2016 01:23 PM
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
Solved! Go to Solution.
Posted on 02-04-2016 08:06 PM
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.
Posted on 02-04-2016 01:40 PM
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: ' "
Posted on 02-04-2016 02:28 PM
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.
Posted on 02-04-2016 08:06 PM
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.
Posted on 02-05-2016 11:20 AM
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!