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 ...
随机推荐
- rman catalog配置简要笔记
服务端配置: SQL> create tablespace tbs_rman datafile 'H:\oradata\test\tbs_rman.dbf' size 20m autoexten ...
- bash中的管道和重定向
管道 管道命令操作符是:”|”,它仅能处理经由前面一个指令传出的正确输出信息,也就是 standard output 的信息,对于 stdandarderror 信息没有直接处理能力.然后,传递给下一 ...
- Android Json的使用(2) 使用Jackson解析和生成json
使用Jackson的三种方式 数据绑定模式:使用最方便 流模式:性能最佳 树模式:最灵活 以最常用的数据绑定模式为例 Json数据如下 { "name" : { "fir ...
- java常用命令行
1.javac(编译java源文件) javac是用来编译.java文件的. 例子: package com.fjassa.domain; public class Human.public cla ...
- @查看MySQL版本的方法
1.在终端下:mysql -V. [root@localhost bin]# mysql -V; mysql Ver 14.14 Distrib 5.6.21, for Linux (x86_64) ...
- 深入理解Java中为什么内部类可以访问外部类的成员
内部类简介 虽然Java是一门相对比较简单的编程语言,但是对于初学者, 还是有很多东西感觉云里雾里, 理解的不是很清晰.内部类就是一个经常让初学者感到迷惑的特性. 即使现在我自认为Java学的不错了, ...
- Python学习:python网址收集
Python学习网址收集: 语法学习:http://www.cnblogs.com/hongten/tag/python/ http://www.liaoxuefeng.com ...
- 数据结构之---C语言实现线索二叉树
//线索二叉树,这里在二叉树的基础上增加了线索化 //杨鑫 #include <stdio.h> #include <stdlib.h> typedef char ElemTy ...
- DotNetBar ComboBoxEx
DotNetBar ComboBoxEx using System; using System.ComponentModel; using System.Drawing; using System.R ...
- JDK自带内存及线程分析工具
转载:http://blog.csdn.net/kimylrong/article/details/50970493 查询.监控.分析Java应用程序的时候,我们关注的点主要集中在资源利用,比如CPU ...