Giter Site home page Giter Site logo

Comments (4)

akinomyoga avatar akinomyoga commented on June 18, 2024 1

Thank you for the information. So ~/.bashrc is sourced from two different places. One place is /etc/profile. The other place is ~/.bash_profile. OMB creates ~/.bash_profile if it doesn't exist because missing ~/.bash_profile causes problems in macOS.

What is your distribution? I'd say /etc/profile sourcing ~/.bashrc is strange. As described in Bash Reference Manual [1] and other places [2,3], ~/.bashrc is supposed to be sourced from ~/.bash_profile. So /etc/profile is not supposed to source ~/.bashrc.

I searched. For example, openSUSE /etc/profile seems to source ~/.bashrc. I have to say the default Bash configurations of openSUSE have been causing problems constantly. It's not maintained well. Maybe the ideal solution is to fix the setup in the distribution, but I'd anticipate that it would be difficult because there are existing users assuming the strange setup of the distributions.

This time, I think you can just comment out the "source ~/.bashrc" part of your ~/.bash_profile.

from oh-my-bash.

akinomyoga avatar akinomyoga commented on June 18, 2024

Sorry for the slow reply. I was busy last week, and I don't have an idea what could cause the behavior in your environment. I need to collect information. What would be the result if you replace echo "Hello $USER" in the above test code as follows?

 if [[ $(hostname) != "vlgsplts02" ]] && [[ $(hostname) != "dlm-lts01" ]]; then
-  echo "Hello $USER"
+  declare -p BASHPID BASH_SOURCE BASH_LINENO >&2
 fi

from oh-my-bash.

cmonty14 avatar cmonty14 commented on June 18, 2024

Thanks for your reply and your support in analyzing this issue.

After modifying .bashrc I get this output:

declare -ir BASHPID="20144"
declare -a BASH_SOURCE=([0]="/sapmnt/HOME/d038783/.bashrc" [1]="/etc/profile")
declare -a BASH_LINENO=([0]="349" [1]="0")
declare -ir BASHPID="20144"
declare -a BASH_SOURCE=([0]="/sapmnt/HOME/d038783/.bashrc" [1]="/sapmnt/HOME/d038783/.bash_profile")
declare -a BASH_LINENO=([0]="5" [1]="0")

Can you conclude from this output why .bashrc is running twice?

from oh-my-bash.

cmonty14 avatar cmonty14 commented on June 18, 2024

Actually I'm running SLES, but this should be equal to openSUSE.
However I was using a customized ~/.bashrc before deploying oh-my-bash, and this error was not showing up.

I will now modify ~/.bash_profile and verify if this is working.

Update:
Removing source ~/.bashrc from ~/.bashrc is the solution.

from oh-my-bash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.