Why doesn't .bashrc work?

Discussion in 'macOS' started by mikezang, Jun 5, 2010.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    I made a new file .bashrc to change prompt at my folder /Users/myfolder, but it doesn't work, what can I do?
     
  2. Hal Itosis macrumors 6502a

    Hal Itosis

    Joined:
    Feb 20, 2010
    #2
    Start by posting the ~/.bashrc file, and then elaborate on what exactly "it doesn't work" means.

    Which text editor did you use to create and/or edit the file?
    Any chance it may have non-Unix line endings? [i.e., not \n]
     
  3. Kollis macrumors newbie

    Kollis

    Joined:
    Jun 5, 2010
    #3
    .bashxx

    Don't know why, but the file I use is named .bash_profile
    and it works.

    HTH
     
  4. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #4
    I used nano to edit my .bashrc file.

    when I run ./.bashrc the "permission dinied" is showed. here is my file as below, may I have to add x permission?

    -rw-r--r-- 1 mikezang staff 19 6 20:09 .bashrc
     
  5. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #5
    You misunderstand how .bashrc is supposed to work. It is supposed to be automatically invoked by the shell, and its contents executed. You shouldn't have to do anything, other than open Terminal as usual.
     
  6. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #6
    I used source .bashrc to activate it.

    How can I change run attribute?
     
  7. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #7
    I changed to use .bash_profile, now everything is ok!
     
  8. Hal Itosis macrumors 6502a

    Hal Itosis

    Joined:
    Feb 20, 2010
    #8
    Yep... the startup behavior will depend on what other dot-files are present.

    I use only ~/.bash_login and ~/.bashrc (and i source the second from the first). That way i have a special file for login shells, and also one for other interactive shells (such as when we execute sudo -s).

    This link might work in your browser (via copy/paste):
    file:///usr/share/doc/bash/bashref.html#SEC66
     

Share This Page