I have a shell script that I run from Xcode to open the root folder in the Terminal. It works as expected when invoked by a function key in Xcode and opens a Terminal window pointing to the value of $SRCROOT as defined in Xcode and an alert with the expected message appears before that.
#! /bin/bash
osascript -e 'display dialog "message" with title "Hi"'
open -a Terminal "$SRCROOT"
Yet when I try to replace "message" to display the contents of $SRCROOT, the dialog doesn't display at all. I've tried all of the approaches listed in the solutions here: osascript using bash variable with a space
Using any of those approaches results in the alert not displaying at all.
I even tried to display the contents of $SRCROOT in a notification with various methods of escaping it but that just displays an empty notification.
Any ideas? TIA.
$SRCROOTto the message?osascript -e 'display dialog "'"$SRCROOT"'" with title "Hi"'. In this, the dialog message is empty, just like in every one of the other attempts. The correct path is opened in the Terminal window though. It's getting it to display in the AppleScript. In this case, it's just~/Developer/SwiftVC.