gpt4 book ai didi

linux - 打开终端窗口并在其中执行自定义命令?

转载 作者:太空宇宙 更新时间:2023-11-04 09:24:37 26 4
gpt4 key购买 nike

我刚刚弄清楚如何打开一个新终端并立即向它发送命令。我在 Linux Mint 上使用的命令是“mate-terminal -x zsh -c '(stuff here) ; exec/bin/zsh”。但是,我在调用 .zshrc 文件中定义的函数和别名方面遇到了困难。相反,它说“zsh:1: command not found:”。

最佳答案

.zshrc 文件仅用于交互式 shell,http://linux.die.net/man/1/zsh

Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc

-i 选项(“Force shell to be interactive.”)可能对你有帮助,试试:

mate-terminal -x zsh -c '(stuff here) ; exec /bin/zsh -i'

或者如果你在 stuff 中有 zshrc 命令:

mate-terminal -x zsh -ci '(stuff here) ; exec /bin/zsh -i'

关于linux - 打开终端窗口并在其中执行自定义命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37903637/

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