Passing quotes “do shell script” in AppleScript… Again

僤鯓⒐⒋嵵緔 提交于 2019-12-11 19:18:47

问题


I have the following line in AppleScript

set msgDate to (current date) as string
set removalString to "\"rm -f ~/Library/LaunchAgents/com.playlister.\"" as string    
do shell script "echo do shell script " & removalString & msgDate & ".plist" & ">> ~/Library/Playlister/" & msgDate & ".applescript"

What I'm trying to do, yet again, is pass the string

do shell script "rm -f ~/Library/LaunchAgents/com.playlister.whateverthedatestampis.plist"

with the quotes in the correct place. I'm moving stuff around quite a bit in a blind attempt to get the quotes right, and I've almost gotten it, but not quite.

Any insight or assistance is appreciated!


回答1:


Are you trying to do this?

set msgDate to (current date) as text
set removalString to "rm -f ~/Library/LaunchAgents/com.playlister."

do shell script "echo do shell script \\\"" & removalString & msgDate & ".plist\\\"" & " >> ~/Library/Playlister/" & quoted form of msgDate & ".applescript"


来源:https://stackoverflow.com/questions/16473980/passing-quotes-do-shell-script-in-applescript-again

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!