我有一个通过zsh -c. 但是,在zsh运行时,它似乎没有加载~/.zshrc.
我知道存在登录 shell 标志,但甚至zsh -lc <command>似乎不起作用。
在运行它时,如何获取~/.zshrc 中定义的函数、别名和变量以填充它zsh -c?
cuo*_*glm 13
zsh不要.zshrc在非交互式 shell 中读取,但zsh允许您调用交互式 shell 来运行脚本:
$ zsh -ic 'type f'
f is a shell function
Run Code Online (Sandbox Code Playgroud)
或者您始终可以.zshrc手动获取:
$ zsh -c '. ~/.zshrc; type f'
f is a shell function
Run Code Online (Sandbox Code Playgroud)