替换Applescript中的撇号
我试图通过shell脚本替换Applescript中的单引号或撇号,但我很难摆脱单引号 将ComputerName设置为执行shell脚本“echo”&Name&“tr-d”替换Applescript中的撇号,applescript,Applescript,我试图通过shell脚本替换Applescript中的单引号或撇号,但我很难摆脱单引号 将ComputerName设置为执行shell脚本“echo”&Name&“tr-d” 我不断遇到语法错误。您可以通过shell脚本这样做: set ComputerName to do shell script "echo " & quoted form of Name & " | tr -d \\' " set ComputerName to do shell script "tr -d
我不断遇到语法错误。您可以通过shell脚本这样做:
set ComputerName to do shell script "echo " & quoted form of Name & " | tr -d \\' "
set ComputerName to do shell script "tr -d \\' <<<" & name's quoted form
(除非变量中碰巧包含pi,这似乎不太可能。)
set my text item delimiters to {pi, "'"}
set ComputerName to the text items of name as text