3.shell:sh

启动(顺序):

--> /etc/profile (login shells)

终止:

Any command or script specified using the command: trap "command" 0

其他:

--> .profile (login shells)

2.shell:tcsh

启动(顺序):

--> /etc/csh.cshrc (always)
--> /etc/csh.login (login shells)
--> .tcshrc (always)
--> .cshrc (if no .tcshrc file is present)
--> .login (login shells)

终止:

-->.logout (login shells)

其他:

--> .history (saves history based on "$savehist")
--> .cshdirs (saves directory stack)

1.shell:CSH

启动(顺序):

--> .cshrc (always)
--> .login (login shells)

终止:

--> .logout (login shells)

其他:

.history (saves history based on "$savehist")

6.shell:zsh

启动(顺序):

--> .zshenv (always, unless the -f option is specified)
--> .zprofile (login shells)
--> .zshrc (interactive shells, unless the -f option is specified)
--> .zlogin (login shells)

终止:

--> .zlogout (login shells)

5.shell:bash

启动(顺序):

--> /etc/profile (login shells)
--> .bash_profile (login shells)
--> .profile (login if no .bash_profile file is present)
--> .bashrc (interactive non-login shells)
--> $ENV (non-interactive shells)

终止:

--> .bash_logout (login shells)

其他:

--> .inputrc (readline initialization)
Linux 中不同操作系统 shell 的环境调用顺序

了解不同 OS Shell 的环境变量的执行顺序对于系统管理员来说非常重要。
这对于设置 cron 作业或者了解在交互式 shell 中运行的命令与使用非交互式 shell 的批处理作业的差异可能很有用。

之路教程 https://onitr oad .com

4.shell:ksh

启动(顺序):

--> /etc/profile (login shells)
--> .profile (login shells)
--> $ENV (always, if it is set)

终止:

Any command or script specified using the command: trap "command" 0
日期:2020-09-17 00:11:03 来源:oir作者:oir