linux系统 /etc/profile分析

环境 centos7

Linux中含有两个重要的文件 /etc/profile和$HOME/.bash_profile 每当系统登陆时都要读取这两个文件,用来初始化系统所用到的变量,其中/etc/profile是超级或所有的用户所用,$HOME/.bash_profile是每个用户自己独立的

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# 用于登录设置函数和别名的系统范围环境和启动程序位于/etc/bashrc中

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
# 最好在/etc/profile.d/中创建一个custom.sh shell脚本,
# 以便对您的环境进行自定义更改,因为这样可以避免在将来的更新中进行合并。

# 1. 首先定义了pathmunge函数, 该函数对环境变量PATH, 进行追加相关路径操作.
pathmunge () {
   
    case ":${
    PATH}:" in
        *:"$1":*)  # a regular expression 
            ;;     # do nothing 
        *)         # 表示其他所有值
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Cheney822

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值