I have the below osascript in bash.
This has worked fine for me for quite some time however recently I used HomeBrew to upgrade my version of bash on my Apple machine from 3.x to 5.x. This works fine in all cases (except osascript) such as clicking on the Terminal app icon or using sudo and I always get version 5.x of bash. However, when the below script runs it opens a window with the old 3.x version of bash.
Does anyone know how to get osascript to also use my new default upgraded version of bash? Or if not the new default then to just force it to use the version I want?
I did try replacing:
tell application "Terminal"
with
tell application "/usr/local/bin/bash"
which didn't bring up a window at all.
Here is the script:
if [ "$APPLE_WINDOW_TYPE" == "window" ]; then
osascript<<EOF
tell application "Terminal"
do script "cd \"`pwd`\"; echo; echo; $1 $2 $3 $4 $5 $6 $7 $8 $9"
end tell
EOF
elif [ "$APPLE_WINDOW_TYPE" == "tab" ]; then
osascript<<EOF
tell application "Terminal"
activate
delay 0.5
tell application "System Events" to keystroke "t" using command down
repeat while contents of selected tab of window 1 starts with linefeed
delay 0.01
end repeat
do script "cd \"`pwd`\"; echo; echo; $1 $2 $3 $4 $5 $6 $7 $8 $9" in window 1
end tell
EOF
sleep 2
fi
Basically I'm using oascript to bring up a new bash window to run various processes in separate windows.