Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
替换Applescript中的撇号_Applescript - Fatal编程技术网

替换Applescript中的撇号

替换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脚本替换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 \\' <<<" & name's quoted form
(除非变量中碰巧包含pi,这似乎不太可能。)

set my text item delimiters to {pi, "'"}
set ComputerName to the text items of name as text