【发布时间】:2015-05-04 04:19:06
【问题描述】:
我一直试图弄清楚如何将多个参数从 Applescript 传递到终端命令脚本。例如,在运行终端命令文件时,您可以像这样以编程方式接收参数:
#!/bin/bash
var=$1
var=$2
我一直在使用的 Applescript 代码供参考:
tell application "System Events" to set app_directory to POSIX path of (container of (path to me))
set thisFile to "Dev"
set testTarget to "/Users/lab/Desktop/TestTarget/"
do shell script "/Users/lab/Desktop/TempRoot/mycommand.command " & thisFile & testTarget with administrator privileges
我认为我出错的地方是第二个参数的输入。当我只有一个参数时,它通过就好了:
do shell script "/path/to/command/mycommand.command" &var with administrative privileges
我很好奇传递第二个参数的正确语法是什么。如果有人有任何建议,请告诉我!另外,如果您需要更多信息,我很乐意提供!
【问题讨论】:
标签: macos bash parameters terminal applescript