Hi all,
I'm trying to get applescript to open terminal as the logged in user, ask for credentials for sudo, switch to the working directory and then run a shell script. I've been working on it for 3 days and still no closer to getting it working. I have tried countless websites for advice but nothing seems to be getting this to work.
This is the script below;
User=$( who | grep console | cut -d" " -f 1 )
sudo -u ${User} /usr/bin/osascript <<EOF
tell application "Terminal"
activate
do script "sudo echo Running bootstrap. Please wait..."
"cd /tmp/12345/macOS/" in window 1
"sh ./12345_bootstrap.sh" in window 1
end tell
EOF
exit 0
