登录式 shell 和非登录式 shell

2023-12-14  本文已影响0人  hemiao3000

登录 shell 的途径

了解两种方式之间的区别,就要先了解 shell 的配置文件:

bash 的配置文件:

由上可知,bash 的配置文件分别为 profile 类文件和 bashrc 类文件:

  1. 设定环境变量。
  2. 运行命令或脚本(登录时运行的脚本)。

profile 类文件作用:
bashrc 类文件配置作用:

了解以上配置文件后,则:

/etc/profile–>/etc/profile.d/*.sh–>~/.bash_profile –>~/.bashrc–>/etc/bashrc

~/.bashrc–>/etc/bashrc–>/etc/prodile.d/*.sh

image.png

而登录式 shell 和非登录式 shell 的运行形式如下:

登录式 shell:

非登录式 shell:

上一篇下一篇

猜你喜欢

热点阅读