bashrc,bash_profile和/etc/profile 最近老出现在shell里面能跑的程序用鼠标双击app去不能跑.究其原因是因为环境变量的问题. 在类unix系统中一般有三个bash配置文件: ~/.bashrc 当前用户使用的配置文件 ~/.bash_profile 当前用户使用的配置文件 /etc/profile 所有用户都会继承的环境配置文件 我们需要搞清楚/etc/profile, ~/.bash_profile和~/.bashrc这几个文件的加载顺序. 一般来说~/.ba…
Some interesting excerpts from the bash manpage:When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After rea…
1. /etc/rc.local 这是使用者自订开机启动程序,把需要开机自动运行的程序写在这个脚本里. 把脚本程序写在/etc/rc.d/init.d/目录下也可以  在完成 run level 3 的服务启动后,如果我还有其他的动作想要完成时,举例来说, 我还想要寄一封 mail 给某个系统管理帐号,通知他,系统刚刚重新开机完毕,那么,是否应该要制作一个 shell script 放置在 /etc/rc.d/init.d/ 里面,然后再以连结方式连结到 /etc/rc.d/rc3.d/ 里面呢…
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行. 并从/etc/profile.d目录的配置文件中搜集shell的设置. /etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取. ~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该 文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件. ~/.bashrc…
profile bashrc bash_profile之间的区别和联系 博客分类: Linux   执行顺序为:/etc/profile -> (~/.bash_profile | ~/.bash_login | ~/.profile) -> ~/.bashrc -> /etc/bashrc -> ~/.bash_logout 关于各个文件的作用域,在网上找到了以下说明: (1)/etc/profile: 此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行,并从/…
在添加环境变量的时候,我们会去修改配置文件 如果留意过,网上博文,有些在/etc/profile文件中配置的,有些是在~./bash_profile文件中配置的,等等 那么,/etc/profile.~/.profile.~/.bashrc.~./bash_profile这几个配置文件有什么区别呢? ~/.profile ~/.bashrc和~./bash_profile .bashrc The individual per-interactive-shell startup file. 这个文…
一 /etc/profile: 此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置.所以如果你有对/etc/profile有修改的话必须得重启你的修改才会生效,此修改对每个用户都生效.可以通过命令source /etc/profile立即生效. 二 /etc/bashrc或/etc/bash.bashrc: 为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.如果你…
profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 2   by:授客 QQ:1033553122 --------------------接Part 1------------------- B.   当bash以interactive shell方式启动时: 如果存在~/.bashrc,bash从~/.bashrc中读取命令并执行 注意: 1.通过--rcfile  file选项可强制ba…
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置. /etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取. ~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件. ~/.bashrc:该…
什么是交互式shell和非交互式shell,什么是login shell 和non-login shell. 交互式模式:就是shell等待你的输入,并且执行你提交的命令.这种模式被称作交互式是因为shell与用户进行交互.这种模式也是大多数用户非常熟悉的:登录.执行一些命令.签退.当你签退后,shell也终止了. 非交互式模式:在这种模式下,shell不与你进行交互,而是读取存放在文件中的命令,并且执行它们.当它读到文件的结尾,shell也就终止了. login shell:就是需要输入用户名…