Take care of Mac BASHRC

Source: Internet
Author: User

Uncle Lemon in the neighborhood.2015-03-11 14:16:261, according to this article:
Http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

To put it simply:
. bash_profile is executed for login shells, while. BASHRC are executed for interactive non-login shells.

Mac OS X-an exception

An exception to the terminal window guidelines is Mac OS X's Terminal.app, which runs a login shell by default for each NE W terminal window, calling Bash_profile instead of BASHRC. The other GUI terminal emulators is the same, but most tend not.

And the bad thing is, Mac is an exception, it will execute bash_profile, but will not go to the tube. BASHRC

===============================
2. Well, the solution is

Edit the. Bash_profile:

If [-f ~/.BASHRC]; Then
SOURCE ~/.BASHRC
Fi
===============================

3. Plus the two commands you need most
Alias Ll= ' Ls-lg '
Alias ls= ' Ls-g '
Alias rm= ' Rm-i '
Alias cp= ' Cp-i '
Alias mv= ' Mv-i '

Export path= "/usr/local/share/npm/bin: $PATH"
Export Node_path=/usr/local/share/npm/lib/node_modules
Export Pythonpath=/usr/local/lib/python3.3/site-packages

One is ll, because I used to use CentOS so ll is very useful, LS also added color. The rest is two path.

===============================

4, always, you need to write in Bash_profile
Clicolor=1
Lscolors=gxfxcxdxbxegedabagacad
Export ps1= ' \[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
#enables colorfor ITerm
Export Term=xterm-color

If [-f ~/.BASHRC]; Then
SOURCE ~/.BASHRC
Fi

-----------------------------
and write in BASHRC.

Alias Ll= ' Ls-lg '
Alias ls= ' Ls-g '
Alias rm= ' Rm-i '
Alias cp= ' Cp-i '
Alias mv= ' mv-i ' The lemon uncle of the neighborhood2015-03-11 14:16:261, according to this article:
Http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

To put it simply:
. bash_profile is executed for login shells, while. BASHRC are executed for interactive non-login shells.

Mac OS X-an exception

An exception to the terminal window guidelines is Mac OS X's Terminal.app, which runs a login shell by default for each NE W terminal window, calling Bash_profile instead of BASHRC. The other GUI terminal emulators is the same, but most tend not.

And the bad thing is, Mac is an exception, it will execute bash_profile, but will not go to the tube. BASHRC

===============================
2. Well, the solution is

Edit the. Bash_profile:

If [-f ~/.BASHRC]; Then
SOURCE ~/.BASHRC
Fi
===============================

3. Plus the two commands you need most
Alias Ll= ' Ls-lg '
Alias ls= ' Ls-g '
Alias rm= ' Rm-i '
Alias cp= ' Cp-i '
Alias mv= ' Mv-i '

Export path= "/usr/local/share/npm/bin: $PATH"
Export Node_path=/usr/local/share/npm/lib/node_modules
Export Pythonpath=/usr/local/lib/python3.3/site-packages

One is ll, because I used to use CentOS so ll is very useful, LS also added color. The rest is two path.

===============================

4, always, you need to write in Bash_profile
Clicolor=1
Lscolors=gxfxcxdxbxegedabagacad
Export ps1= ' \[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
#enables colorfor ITerm
Export Term=xterm-color

If [-f ~/.BASHRC]; Then
SOURCE ~/.BASHRC
Fi

-----------------------------
and write in BASHRC.

Alias Ll= ' Ls-lg '
Alias ls= ' Ls-g '
Alias rm= ' Rm-i '
Alias cp= ' Cp-i '
Alias mv= ' Mv-i ' about Mac. bashrc file Configuration

Before some of the bash operating habits on the server wanted to keep on the Mac, like the command to log on to the server on a springboard, I saved the command on the server so that I could log in to the server after a short command type.

For example, in the. bashrc file to add the following, the script login.sh is written by their own landing script. The script will differentiate the landing environment according to the input parameters. Then select the landing machine based on another parameter.

Alias Beta= ' ~/login.sh beta ' alias prod= "~/login.sh prod"

Then use the source command to update the resource file

source. BASHRC

You can then use the following command

Beta Machinenamekeywords

Now I need to apply this script to bash on my Mac machine. Discover that there is not such a. bashrc file on your Mac, and that some of the custom aliases on your Mac are stored in the. bash_profile file. As I met

Mac OS X is based on FreeBSD, so some tools ls, top, etc. are BSD that set, LS is not GNU ls, so even if the TERMINAL/ITERM2 is configured with color, but on the Mac-typed LS command will not be highlighted, you can install Coreutils to solve (brew install coreutils), but if the LS color is not picky, there is a simple way to output clicolor=1 in. Bash_profile:

Link Address: http://www.vpsee.com/2013/09/use-the-solarized-color-theme-on-mac-os-x-terminal/

http://www.douban.com/note/321472256/

To put it simply:

. bash_profile is executed for login shells, while. BASHRC are executed for interactive non-login shells.

Mac OS X-an exception

An exception to the terminal window guidelines is Mac OS X's Terminal.app, which runs a login shell by default for each NE W terminal window, calling Bash_profile instead of BASHRC. The other GUI terminal emulators is the same, but most tend not.

And the bad thing is, Mac is an exception, it will execute bash_profile, but will not go to the tube. BASHRC

So you can see in general where you want to add bash configuration, the tutorial is using the. bash_profile configuration. Instead of saying modify this. bashrc file. The reason for these differences is that the MAC bash is a loginbash, Loginbash will load. Bash_profile does not load the. bashrc file. So what we're going to do is

Reference documents:

The difference between Login-bash and Nonlogin-bash: http://www.cnblogs.com/qcly/p/3273373.html

http://my.oschina.net/yunyue/blog/108399

Take care of Mac BASHRC

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.