gpt4 book ai didi

bash - 使用 "open -a Terminal"传递参数

转载 作者:行者123 更新时间:2023-12-05 05:23:37 25 4
gpt4 key购买 nike

看来这是一个很愚蠢的问题。
我正在尝试使用 bash 文件中的(另一个)终端打开一个 bash 文件,提供两个参数。

像这样:

open -a Terminal path/to/file.sh ARG1 ARG2

我试过类似的东西,它没有给我任何错误,但只是没有提供参数:

open -a Terminal path/to/file.sh --args ARG1 ARG2

有人可以帮助我吗?

最佳答案

我想你的意思是:

osascript -e 'tell application "Terminal" to do script "date +s"'

或者这个有参数的:

osascript -e 'tell application "Terminal" to do script "echo 'arg2' 'arg2'"'

或者这种工作方式可能更适合:

osascript<<EOF
tell application "Terminal"
do script "yourScript $1 $2"
end tell
EOF

关于bash - 使用 "open -a Terminal"传递参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37325805/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com