Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: ~/.bashrc sourced twice?

  1. #1

    Default ~/.bashrc sourced twice?

    Hi,

    I just installed openSUSE 11 RC. I have my $PATH definition in my home ~/.bashrc file, and everything was fine with SuSE 10.3 (however on another computer). Now, my $PATH variable contains twice every element defined in .bashrc.

    It thus seems that the PATH defined in this file is sourced twice, which shouldn't be the case, right?

    It seems to me that it is read once then bash is invoked and once at login, since when I delete the file and relaunch the terminal without logging out, I got only one copy of the PATH. Whenever I logout, I then have none anymore. If then I login, I have none of the elements, and if I recreate the .bashrc file, and close the terminal and relaunch, I have again one. If I subsequently logout and login, I have two copies again...

    Any ideas or suggestions?

    Thx!

  2. #2
    Join Date
    Mar 2008
    Location
    San Diego (California)
    Posts
    475

    Default Re: ~/.bashrc sourced twice?

    could you post the output of the command
    Code:
     echo $PATH
    ~ There are 10 types of people. Those who understand binary, and those who don't. ~

  3. #3

    Default Re: ~/.bashrc sourced twice?

    Sure! It's quite long... but as you may see, everything is repeated from /home/me/bin.

    (output anonymized, newlines added for readability. Repeat is not an c/c error)

    Code:
    /home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib/qt3/bin:
    /home/me/bin:/home/me/assembly:/usr/local/bin:/opt/bio/bin:/usr/local/bin/MUMmer3.20:/opt/bio/phredphrap:/home/other/lib/myPerlObjects:/home/other/me/annotation:/home/other/lib/GENOME/glimmer3.01/bin:/home/other/lib/GENOME/glimmer3.01/scripts:
    /home/me/bin:/home/me/assembly:/usr/local/bin:/opt/bio/bin:/usr/local/bin/MUMmer3.20:/opt/bio/phredphrap:/home/other/lib/myPerlObjects:/home/other/me/annotation:/home/other/lib/GENOME/glimmer3.01/bin:/home/other/lib/GENOME/glimmer3.01/scripts
    And here is my .bashrc (anonymized, too)

    Code:
    #echo "Reading ~/.bashrc"
    
    # PATH
    PATH=$PATH:$HOME/bin:$HOME/assembly:/usr/local/bin
    
    # various programs
    PATH=$PATH:/opt/bio/bin
    
    # MUMmer
    PATH=$PATH:/usr/local/bin/MUMmer3.20
    # phredphrap
    PATH=$PATH:/opt/bio/phredphrap
    export CONSED_HOME=/opt/bio/phredphrap
    
    # annotation pipeline (temporary)
    PATH=$PATH:/home/other/lib/myPerlObjects
    PATH=$PATH:/home/other/me/annotation
    
    #art/act (Artemis Comparison Tool)
    alias act='/home/other/lib/GENOME/artemis/act'
    alias art='/home/other/lib/GENOME/artemis/art'
    
    #Glimmer 3
    PATH=$PATH:/home/other/lib/GENOME/glimmer3.01/bin
    PATH=$PATH:/home/other/lib/GENOME/glimmer3.01/scripts
    export G3_SPATH=/home/other/lib/GENOME/glimmer3.01/scripts
    export G3_PATH=/home/other/lib/GENOME/glimmer3.01/bin
    
    #nt/aa matrices for BLAST
    #export BLASTMAT=/opt/bio/data/blast/matrix/aa
    export BLASTMAT=/opt/bio/bin
    
    
    # coloring ls command
    alias ls="ls --color"
    #export LSCOLORS=dxfxcxdxbxegedabagacad
    LS_COLORS="no=00;32:fi=00:di=00;34:ln=01;36:pi=04;33:so=01;35:bd=33;04:cd=33;04:or=31;01:ex=00;32:*.rtf=00;33:*.txt=00;33:*.html=00;33:*.doc=00;33:*.pdf=00;33:*.ps=00;33:*.sit=00;31:*.hqx=00;31:*.bin=00;31:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.deb=00;31:*.dmg=00;36:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.ppm=00;35:*.tga=00;35:*.xbm=00;35:*.xpm=00;35:*.tif=00;35:*.mpg=00;37:*.avi=00;37:*.gl=00;37:*.dl=00;37:*.mov=00;37:*.mp3=00;35"
    
    export LS_COLORS
    
    # fancy terminal
    export PS1="\h:\w\$: "
    
    # changing umask to have writing access for group
    umask 002
    
    # export PATH
    export PATH

  4. #4
    Join Date
    Mar 2008
    Location
    San Diego (California)
    Posts
    475

    Default Re: ~/.bashrc sourced twice?

    hmm that's weird i do not have $PATH set in my .bashrc file (i use Bash shell though), in any of my computers, however they are all running different versions than 11... so i cannot make valid comparison.

    Anyway could you inspect your file /etc/profile
    and paste those lines that follow a commented line that says
    # Make path more comfortable
    Until the next commented line
    Not sure if you have it (i am looking at my 10.3) but if so, inspecting those might give us some clues
    ~ There are 10 types of people. Those who understand binary, and those who don't. ~

  5. #5

    Default Re: ~/.bashrc sourced twice?

    There it is:

    Code:
    #
    # Make path more comfortable
    #
    if test -z "$PROFILEREAD" ; then
        PATH=/usr/local/bin:/usr/bin:/bin
        if test "$HOME" != "/" ; then
    	for dir in $HOME/bin/$CPU $HOME/bin ; do
    	    test -d $dir && PATH=$dir:$PATH
    	done
        fi
        if test "$UID" = 0 ; then
    	test -d /opt/kde3/sbin  && PATH=/opt/kde3/sbin:$PATH
    	PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
        fi
        for dir in	/usr/X11/bin \
    		/usr/bin/X11 \
    		/usr/X11R6/bin \
    		/var/lib/dosemu \
    		/usr/games \
    		/opt/bin \
    		/opt/kde3/bin \
    		/opt/kde2/bin \
    		/opt/kde/bin \
    		/usr/openwin/bin \
    		/opt/cross/bin
        do
    	test -d $dir && PATH=$PATH:$dir
        done
        unset dir
        export PATH
    fi
    I remarked another strange behavior... When I renamed .bashrc .profile in my home dir, and logged out/in, I still had the PATH set correctly (and only once), but all the rest (aliases, PS1 export, LS_COLORS) was not set correctly. For example, there are a couple of aliases (like alias xxx="ssh -X me@aaa.bbb.ccc.net", that I removed from the file pasted above) that work quite well with .bashrc, but not with .profile...

  6. #6
    Join Date
    Mar 2008
    Location
    San Diego (California)
    Posts
    475

    Default Re: ~/.bashrc sourced twice?

    Quote Originally Posted by bacillus_anthracis View Post
    work quite well with .bashrc, but not with .profile...
    That part of the /etc/profile is identical to mine.
    If you are using bash, you should put stuff in .bashrc, not in .profile, which (as far as i know) is used for the shells ksh or sh.
    My .profile file for example has one line only that is uncommented, which is just test -z "$PROFILEREAD" && . /etc/profile.
    Now the cause of the double entries in your path might just be the fact that you are trying to edit the ~/.profile duplicating over there entries that are already in .bashrc... not sure if i understand well: is this what you are doing?
    Can you post your ~/.profile content ?
    ~ There are 10 types of people. Those who understand binary, and those who don't. ~

  7. #7

    Default Re: ~/.bashrc sourced twice?

    First, and above all, thanks for your precious help... Should have started with that

    I don't use .profile and .bashrc at the same time. I use only .bashrc, and the .profile thing was just to try something. Normally, I don't even have a .profile file in my home...

    I have to add that I had exactly the same .bashrc on a SuSE 10.3 (but on another computer), and that it was working quite well (however I was accessing it with ssh).

  8. #8
    Join Date
    Mar 2008
    Location
    San Diego (California)
    Posts
    475

    Default Re: ~/.bashrc sourced twice?

    Ok i see.
    I was tempted to say to try commenting all the entries in .bashrc that have $PATH. However if your other machine does have the same entries, it might be the wrong point where to look for errors.

    Do you have a file
    /etc/bash.bashrc.local ?
    I personally do not have, it does not even exist on my system. But if for some reasons it was created, it might be the cause of the anomalies, as it duplicates the entries in .bashrc

    If you do not have that file, well i would try to comment out the entries in .bashrc that deal with PATH. In the worst case, even if you are no longer able to login normally as a user, you can always login as root and remove the comment symbols from the file, thus restoring the previous situation.
    ~ There are 10 types of people. Those who understand binary, and those who don't. ~

  9. #9

    Default Re: ~/.bashrc sourced twice?

    As you, I don't have a /etc/bash.bashrc.local.

    I commented all PATH entries (setting PATH and export), log out/in, and now my $PATH looks like:

    Code:
    /home/lionel/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib/qt3/bin

  10. #10
    Join Date
    Mar 2008
    Location
    San Diego (California)
    Posts
    475

    Default Re: ~/.bashrc sourced twice?

    to me that looks a lot more normal now than before.
    See this is mine:

    /opt/kde3/bin:/home/rossana/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib/qt3/bin

    this is yours

    /home/lionel/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib/qt3/bin

    My suggestion is going on this way, if you ever encounter any problems in installing applications you can always add manually setting the path.
    But i doubt you will have lots of problems, as i have been installing and manually compiling lots and lots of apps and never had any problems at all with paths
    ~ There are 10 types of people. Those who understand binary, and those who don't. ~

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •