I'm trying to develop a bash script for OSX which asks the user whether or not they want to perform an action. When they answer yes (y) I want it to display a notification using AppleScript which sort of works at the moment. However, I wish to embed a variable inside this AppleScript notification but I am unable to escape it. My code at the moment is
#! /bin/bash
DATE="$( date '+%d/%m/%Y %H:%M:%S' )"
while true; do
read -p "Would you like to know the date? (y/n)" yn
case $yn in
[Yy]* ) osascript -e 'display notification "$DATE" with title "Todays date"'; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
However when I run it, this is what I get:
Does anyone have any idea of how to modify my script in such as way that it will simply display the variable $DATE rather than the name of the variable?
Thank you in advance for any help, Kind regards,
Tom