When you’re using Bash scripts it’s sometimes necessary to show a window to the user asking for specific information or showing warning through AppleScript.
After a long Google search, I finally found how to add Bash variables directly into a “display dialog” window using the command “osascript-e”.Β It is sufficient to use the single quotation mark : ‘$EXAMPLE’
This example will show the Bash variable “$LAST_CONNEXION_DATE” in a window :
osascript -e 'tell app "System Events" to display dialog "Last connextion date : '$LAST_CONNEXION_DATE'" buttons {"Cancel", "Continue"} cancel button "Cancel" default button "Continue"'
At last!! Thank you.
Thanks for saving me time and frustration figuring this out.
Very good. In fact…
osascript -e ‘display dialog “Last connextion date : ‘$LAST_CONNEXION_DATE'” buttons {“Cancel”, “Continue”} cancel button “Cancel” default button “Continue”‘
…is sufficient.
Hey! 8 years later you’re still helping people. Thanks
He made me laugh this one π ππ»
It’s true!