I am trying to write a bash script that reloads a given chrome tab, and I am passing the variable POSITION_STRING
to applescript to dynamically determine the definition of the statement (as I thought thats what heredocs notations are used to do).
But it seems applescript rejects this type of connotation, help?
declare -A POSSIBLE_POSITIONS
POSSIBLE_POSITIONS=(
["1"]="first"
["2"]="second"
["3"]="third"
["4"]="fourth"
["5"]="fifth"
["6"]="sixth"
["7"]="seventh"
["8"]="eighth"
["9"]="ninth"
["10"]="tenth"
)
# echo "${POSSIBLE_POSITIONS[$1]}"
POSITION=$1
POSITION_STRING=${POSSIBLE_POSITIONS[$POSITION]}
# echo $POSITION_STRING
/usr/bin/osascript <<EOF
log "$POSITION_STRING" # this works!
tell application "Google Chrome"
tell the "$POSITION_STRING" tab of its first window
# reload
end tell
end tell
EOF