【问题标题】:Open terminal windows and execute custom commands in them?打开终端窗口并在其中执行自定义命令?
【发布时间】:2016-10-20 14:15:57
【问题描述】:
我刚刚想出了如何打开一个新终端并立即向它发送命令。我在 Linux Mint 上使用的命令是“mate-terminal -x zsh -c '(stuff here) ; exec /bin/zsh”。但是,我在调用 .zshrc 文件中定义的函数和别名方面遇到了困难。相反,它显示“zsh:1: command not found:”。
【问题讨论】:
标签:
linux
terminal
zsh
linux-mint
zshrc
【解决方案1】:
.zshrc 文件仅用于交互式 shell,http://linux.die.net/man/1/zsh
然后,如果 shell 是交互式的,则从/etc/zshrc 读取命令,然后从$ZDOTDIR/.zshrc 读取命令
有-i 选项(“强制shell 进行交互。”)可以帮助你,试试:
mate-terminal -x zsh -c '(stuff here) ; exec /bin/zsh -i'
或者如果你有 zshrc 命令:
mate-terminal -x zsh -ci '(stuff here) ; exec /bin/zsh -i'