Applescript更改文件夹和终端命令


1

我尝试了以下但似乎无法使其工作:

do script "cd ~/desktop/test; for x in ls -1 | sed -e 's/^\(.\).*/\1/' | sort -u; do mv -i ${x}?* $x done"

我想在applescript中执行这个命令。我在AppleScript中运行这个并且我得到关于“”标记的错误,但我不确定如何纠正它。我是AppleScript的新手。愿意学会一点迷失。

谢谢

Answers:


1

一般在使用do shell脚本命令时,您需要使用文本对象的带引号的表单属性。换句话说,做这样的事情。

set command to "ls"
set result to do shell script quoted form of command
display dialog result
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.