Bashrc, bash_profile, and/etc/profile

Source: Internet
Author: User

Bashrc, bash_profile, and/etc/profile

Recently, applications that can run in shell cannot be run by double-clicking the app. The reason is that the environment variable is faulty.

In Unix-like systems, there are generally three Bash configuration files:

  • ~ /. Bashrc configuration file used by the current user
  • ~ /. Bash_profile configuration file used by the current user
  • /Etc/profile environment configuration files inherited by all users

We need to figure out/etc/profile ,~ /. Bash_profile and ~ /. Bashrc file loading sequence.

Generally ~ /. Bash_profile> ~ /. Bash_rc>/etc/profile, that is, if bash_profile is not found, use/etc/profile if bashrc is not found.

Interested can refer to this blog: http://blog.galeo.me/post/23467503436/path-environment-variable-on-mac-os-x-emacs-app

 

The. bash_profile file is read in the shell of MacOSX, but the. bashrc file does not have to be read. Two configurations are also a headache, but stackoverflow provides a solution.

Terminal opens a login shell. This means ,~ /. Bash_profile will get executed ,~ /. Bashrc not. The solution on most systems is to „ require "~ /. Bashrc in ~ /. Bash_profile: Just put this snippet in your ~ /. Bash_profile:

[[ -s ~/.bashrc ]] && source ~/.bashrc

Bashrc, bash_profile, and/etc/profile

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.