0
我正在尝试编写一个bash脚本来重新载入给定的chrome选项卡,并且我将变量POSITION_STRING
传递给applescript以动态确定该语句的定义(因为我认为这是什么heredocs符号被用来做)。如何解释applescript命令中的bash变量
但似乎苹果拒绝这种类型的内涵,帮助?
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
多感谢你,阿尔法 – user2167582