I have it at the top. Bashrc, First returning shells for non-interactive
food = "bar"; Food Drain "Hello World" Export # If the interactive is not running, do not do anything [-S "$ PS1"] & amp; Amp; #! / Bin / bash resonance "a" echo "$ echo" b "
I execute test.sh Output:
AB 2 questions:
- Why do not I see the value of $ FOO?
- Why do not I see "Hello World"?
Edit: I thought that #! With script / bin / bash, the script triggers a subsealand which will call .bashrc again, am I wrong?
Edit: Even if I call a script from another host, I will not see any value. Even then, will .bashrc be executed?
ssh remotehost "/home/username/test.sh"
.bashrc is automatically available only for non login interactive shells. Often, you will enter .bashrc your .bash_login Near the beginning of the file, to make sure that .bashrc is the source for both login and non-login interactive shells.
.bashrc is not automatically sourced for non-interactive shells, such as when you execute shell scripts start up.
Since you export FOO to .bashrc , the fact is that test.sh looks FOO < / Code> Having a null value reveals that you are running the script from the login shell. Does the buzz echo $ from print bar ? I would wonder if it did and did not test.sh .
No comments:
Post a Comment