gpt4 book ai didi

macos - 你如何打开一个带有特定路径的终端?

转载 作者:行者123 更新时间:2023-12-04 17:41:13 24 4
gpt4 key购买 nike

如何使用终端打开另一个终端窗口但使用我指定的路径?

我在上类时使用 automator 加载我的工作内容,但我需要知道如何执行此操作:

打开终端并输入:
• cd 工作/公司/项目/
• 脚本/服务器

然后该终端窗口中的新选项卡和 cd 到同一文件夹。

最佳答案

这会从 Mac OSX 上的命令提示符打开一个新的终端窗口,执行“cd/”,然后将窗口保持在顶部:

osascript -e 'tell application "terminal"' -e 'do script "cd /"' -e 'end tell'

您可以将其放入这样的脚本中:
#!/bin/sh
osascript -e 'tell application "terminal"' -e "do script \"cd $1\"" -e 'end tell'

希望这可以帮助。

关于macos - 你如何打开一个带有特定路径的终端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3390887/

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