.profile missing

Discussion in 'macOS' started by tirwit, Apr 30, 2010.

  1. tirwit macrumors newbie

    Joined:
    Jan 20, 2010
    #1
  2. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #2
    You can create it, but it may not get executed. The order in OS X is:

    1. .bash_profile
    2. .bash_login
    3. .profile

    So you may want to edit or create a .bash_profile instead. Or you could create .profile and add this to .bash_profile:

    Code:
    if [ -e ~/.profile ]; then
         source ~/.profile
    fi
    
    This way it will get called. There is then the difference of interactive non-login shells and login shells, but we won't worry about that.
     
  3. tirwit thread starter macrumors newbie

    Joined:
    Jan 20, 2010
    #3
    ah ok... Does that mean that it's no use to have more than the .bash_profile? Or does .bash_login and .profile do different things?

    So what's the .bashrc for?
     
  4. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #4
    Technically, they should do different things. But they do not have to do different things.

    I would just work with the .bash_profile for now.
     
  5. tirwit thread starter macrumors newbie

    Joined:
    Jan 20, 2010
    #5
    And .bashrc is for what?

    Thanks for the help mate :)
     
  6. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #6
    That is the distinction I mentioned.

    .bashrc gets executed for interactive non-login shells while .bash_profile is executed for login shells.

    You may want to spend some time reading the bash man page:

    Code:
    man bash
    It covers many of these things in the "Invocation" section.
     
  7. tirwit thread starter macrumors newbie

    Joined:
    Jan 20, 2010
  8. tirwit thread starter macrumors newbie

    Joined:
    Jan 20, 2010
    #8
    Ok, I've read it. I didn't understood lots of things. But at least got the notion of what is a interactive and non-interactive shell.

    One thing I don't get thou... I've erased my bashrc (totally blank now), but it still appears this when I start the shell:

    Code:
    MacBook-de-Pedro-Gordo:~ Pedro_Gordo$ bash
    bash: {rtf1ansiansicpg1252cocoartf1038cocoasubrtf290: command not found
    bash: {fonttbl}: command not found
    bash: /Users/Pedro_Gordo/.bashrc: line 3: syntax error near unexpected token `}'
    bash: /Users/Pedro_Gordo/.bashrc: line 3: `{\colortbl;\red255\green255\blue255;}'
    bash-3.2$ 
    Any idea what this is and how may I solve it?
     

Share This Page