bashrc,bash_profile和/etc/profile
bashrc,bash_profile和/etc/profile
最近老出现在shell里面能跑的程序用鼠标双击app去不能跑.究其原因是因为环境变量的问题.
在类unix系统中一般有三个bash配置文件:
- ~/.bashrc 当前用户使用的配置文件
- ~/.bash_profile 当前用户使用的配置文件
- /etc/profile 所有用户都会继承的环境配置文件
我们需要搞清楚/etc/profile, ~/.bash_profile和~/.bashrc这几个文件的加载顺序.
一般来说~/.bash_profile > ~/.bash_rc > /etc/profile, 也就是说当没有找到bash_profile则使用bashrc再没找到就用/etc/profile
有兴趣的可以参考这篇博文: http://blog.galeo.me/post/23467503436/path-environment-variable-on-mac-os-x-emacs-app
在MacOSX的shell中读取的是.bash_profile,而不读取.bashrc.有两个配置也挺让人头痛的,不过stackoverflow给出了解决方案
Terminal opens a login shell. This means, ~/.bash_profile will get executed, ~/.bashrc not. The solution on most systems is to „require“ the ~/.bashrc in the ~/.bash_profile: just put this snippet in your ~/.bash_profile:
[[ -s ~/.bashrc ]] && source ~/.bashrc
bashrc,bash_profile和/etc/profile的更多相关文章
- profile bashrc bash_profile之间的区别和联系
profile bashrc bash_profile之间的区别和联系 博客分类: Linux 执行顺序为:/etc/profile -> (~/.bash_profile | ~/.bas ...
- Bash: about .bashrc, .bash_profile, .profile, /etc/profile, etc/bash.bashrc and others
Some interesting excerpts from the bash manpage:When bash is invoked as an interactive login shell, ...
- profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 2
profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 2 by:授客 QQ:103355312 ...
- /etc/rc.local ; /etc/init.d ;/etc/profile;/etc/bashrc;~/.bash_profile;~/.bashrc;~/.bash_logout
1. /etc/rc.local 这是使用者自订开机启动程序,把需要开机自动运行的程序写在这个脚本里. 把脚本程序写在/etc/rc.d/init.d/目录下也可以 在完成 run level 3 ...
- /etc/profile /etc/bashrc ~/.bash_profile ~/.bashrc ~/.bash_logout 说明及区别
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行. 并从/etc/profile.d目录的配置文件中搜集shell的设置. /etc/bashrc:为每一 ...
- profile bashrc bash_profile 之间的区别和联系
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置. /etc/bashrc:为每一个 ...
- linux profile\bashrc\bash_profile之间的区别和联系
/etc/profile 每个用户,首次登录时被执行: /etc/bashrc 每个运行bash shell的用户都执行此文件,当bsh被打开时,该文件被读取: ~/.bash_profile 专用于 ...
- linux /etc/profile bashrc bash_profile
文件: /etc/profile ~/.bashrc 和 ~/.bash_profile 的使用区别: /etc/profile: 全局 环境变量等,在机器重启后执行一次, 用于设置环境变量,更 ...
- etc/profile /etc/bashrc ~/.bash_profile ~/.bashrc等配置文件区别
什么是交互式shell和非交互式shell,什么是login shell 和non-login shell. 交互式模式:就是shell等待你的输入,并且执行你提交的命令.这种模式被称作交互式是因为s ...
随机推荐
- jQuery中的Ajax全局事件
Ajax全局事件 全局事件会在有ajax请求的情况下触发. 方法名称 说明 ajaxStart(callback) Ajax请求开始时执行的函数 ajaxStop(callback) Ajax请求结束 ...
- socket心跳包机制实践与理解
实现Socket心跳包主要分为两大类,第一采用tcp自带的KeepAlive,第二是自定义心跳包,恰巧我在产品VICA中都使用过,下面就这两种心跳包机制谈谈个人的理解与感受. 首先第一种KeepAli ...
- 解决Centos运行yum 报错:坏的解释器
# ll /usr/bin/python python python2 python2.6 python2.7 python.bak 1,这里先备份原来的/usr/bin/python 为python ...
- linux面试题目—2
linux面试题目—2 二 选择题 1.关闭linux系统(不重新启动)可使用命令 B . A Ctrl+Alt+Del B halt C shutdown -r now D reboot 2.实现从 ...
- Eclipse启动时禁用不必要的验证。
window>preferences>general>editors>text editors>Annotations,右边的Annotation type里,点选err ...
- Android4.4系统源码百度网盘下载
众所周知.Android如今非常火,肯定也有非常多android开发人员像我一样想研究android系统的源码.可是假设依照Google官方站点http://source.android.com/so ...
- iOS:quartz2D绘图(处理图像,绘制图像并添加水印)
绘制图像既可以重写drawRect:方法并在该方法中绘制,也可以不用重写该方法,它有封装好的函数获取自己的图像绘制上下文,即UIGraphicsBeginImageContext(CGSize siz ...
- iconv的安装和使用
一.Linux下iconv的安装包的下载页面http://www.gnu.org/software/libiconv/ $ ./configure --prefix=/usr/local$ make$ ...
- 关于mysql字段名和保留字冲突的问题
建了个表,有个字段起名为key,结果insert语句报错了,说是sql不对. 原因:字段key和MySQL的保留字冲突了,当mysql的字段名和保留字冲突的时候,sql语句中的字段名需要加上反引号`` ...
- Json.net说法——(一)修饰标签,日期序列化
摘自: http://www.cnblogs.com/jams742003/archive/2009/12/24/1631587.html 通过属性标签自定义JSON序列化 JsonObjectAtt ...