0

I'm trying to create a script that will bring up a popup window with info that involves a variable created earlier in the script.

I initially made the following and it works:

#!/bin/bash -v

minToRestart=5

osascript -e 'display dialog "Software installations have completed.

Your Mac will automatically reboot in '$minToRestart' minutes.

If you want to restart immediately instead, click the \"Restart Now\" button." with title "Software Update > Updates Complete" buttons {"OK", "Restart Now"} default button "Restart Now"'

However, in looking online it looks like the better way to do this is using the on run argv command. After a lot of troubleshooting I came up with this:

#!/bin/bash -v

minToRestart=5
restartMessage="Software installations have completed.

Your Mac will automatically reboot in '$minToRestart' minutes.

If you want to restart immediately instead, click the \"Restart Now\" button."

osascript -e 'on run {argv}' -e 'display dialog argv with title "Software Update > Updates Complete" buttons {"OK", "Restart Now"} default button "Restart Now"' -e 'end run' $restartMessage

The only problem is that instead of writing the whole $restartMessage, it only writes the first word (Software). What can I do to get it to display the whole $restartMessage variable?

it7276
  • 1
  • 1
  • Maybe https://stackoverflow.com/q/23923017/1531971 –  Oct 17 '17 at 16:26
  • Thanks, I'd seen that before (I think @charles-duffy's comments are why I was trying to use on run argv). I'll try using his second recommendation (with EOF) to see if I get any different results. – it7276 Oct 18 '17 at 17:57
  • I can't get the EOF instructions to work. I'm going to give up on on run argv and just use the first commands since those work for me. – it7276 Oct 19 '17 at 15:57

0 Answers0