You appear to be setting environment variables (“PATH”) in your .bashrc or .zshrc: those files are only read by interactive shells, so you should instead set environment variables in startup files like .profile, .bash_profile or .zshenv. Refer to your shell’s man page for more info. Customize ‘exec-path-from-shell-arguments’ to remove “-i” when done, or disable ‘exec-path-from-shell-check-startup-files’ to disable this message. ----用的zsh.
类似问题已在本站出现过呢, 建议提前搜索一下.
抱歉,或许用的关键词不对,没搜到。 另,那贴子里没说具体为什么会出现这情况, 知其然不知其所以然的感觉太不爽了,强迫症伤不起啊-_-!
为知其所以然,先认真读完warning并按上述去度man page
STARTUP/SHUTDOWN FILES
Commands are first read from /etc/zshenv; this cannot be overridden. Subsequent behaviour is modified by the RCS and
GLOBAL_RCS options; the former affects all startup files, while the second only affects global startup files (those shown
here with an path starting with a /). If one of the options is unset at any point, any subsequent startup file(s) of the
corresponding type will not be read. It is also possible for a file in $ZDOTDIR to re-enable GLOBAL_RCS. Both RCS and
GLOBAL_RCS are set by default.
Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zprofile and then
$ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc.
Finally, if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
When a login shell exits, the files $ZDOTDIR/.zlogout and then /etc/zlogout are read. This happens with either an explicit
exit via the exit or logout commands, or an implicit exit by reading end-of-file from the terminal. However, if the shell
terminates due to exec'ing another process, the logout files are not read. These are also affected by the RCS and
GLOBAL_RCS options. Note also that the RCS option affects the saving of history files, i.e. if RCS is unset when the shell
exits, no history file will be saved.
If ZDOTDIR is unset, HOME is used instead. Files listed above as being in /etc may be in another directory, depending on
the installation.
As /etc/zshenv is run for all instances of zsh, it is important that it be kept as small as possible. In particular, it is
a good idea to put code that does not need to be run for every single shell behind a test of the form `if [[ -o rcs ]]; then
...' so that it will not be executed when zsh is invoked with the `-f' option.
Any of these files may be pre-compiled with the zcompile builtin command (see zshbuiltins(1)). If a compiled file exists
(named for the original file plus the .zwc extension) and it is newer than the original file, the compiled file will be used
instead.
其实重点是你需要明白profile和rc的用途区别,rc只被交互式shell使用
看了半天,还是啥都没看懂,知识量太少,只能先搁置了。