Environment Variables not getting set in bash_profilessh user@IP sh <command> missed environment variablesNone of the dot-files is sourced when running bash via ssh, part IIFedora 7 server export in .bashrc not getting set184 environment variables too many?Setting environment variables with .bash_profile: only last export works properlyset environment variables from stdoutWhy are Environment Variables Not Set GnomeRunning a command after my OpenVPN client connectsWhat is the status of setting environment variables without ~/.bash_profile?sudo not executing bashrc as expected
Copenhagen passport control - US citizen
What is the command to reset a PC without deleting any files
What would the Romans have called "sorcery"?
Infinite past with a beginning?
Draw simple lines in Inkscape
Is Social Media Science Fiction?
"which" command doesn't work / path of Safari?
Can I interfere when another PC is about to be attacked?
Prevent a directory in /tmp from being deleted
Copycat chess is back
Why Is Death Allowed In the Matrix?
Compute hash value according to multiplication method
Example of a relative pronoun
Work Breakdown with Tikz
How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)
How does one intimidate enemies without having the capacity for violence?
What typically incentivizes a professor to change jobs to a lower ranking university?
"You are your self first supporter", a more proper way to say it
Why is this code 6.5x slower with optimizations enabled?
Email Account under attack (really) - anything I can do?
Pronouncing Dictionary.com's W.O.D "vade mecum" in English
How old can references or sources in a thesis be?
What makes Graph invariants so useful/important?
What defenses are there against being summoned by the Gate spell?
Environment Variables not getting set in bash_profile
ssh user@IP sh <command> missed environment variablesNone of the dot-files is sourced when running bash via ssh, part IIFedora 7 server export in .bashrc not getting set184 environment variables too many?Setting environment variables with .bash_profile: only last export works properlyset environment variables from stdoutWhy are Environment Variables Not Set GnomeRunning a command after my OpenVPN client connectsWhat is the status of setting environment variables without ~/.bash_profile?sudo not executing bashrc as expected
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have my bash_profile environment setting as follows:
if [ `hostname` = "devoraebs01" ]; then
echo `hostname -f`
. /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
When I log into this host, it echoes the hostname correctly. But I've noticed that when I try to execute some shell script, I get errors until I run the ". /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env" manually.
Nothing appears to be incorrect with the syntax. Any idea why this isn't getting set correctly at my initial login?
Here's the entire contents of . /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
:
customfile=/appl_top/deverp/appl/customDEVERP_devoraebs01.env
if [ -f $customfile ]; then
. /appl_top/deverp/appl/customDEVERP_devoraebs01.env
fi
. /db/u01/conf_top/DEVERP_devoraebs01/8.0.6/DEVERP_devoraebs01.env
. /appl_top/deverp/appl/DEVERP_devoraebs01.env
I am logging into the host via PuTTY.
linux bash environment-variables profile
|
show 7 more comments
I have my bash_profile environment setting as follows:
if [ `hostname` = "devoraebs01" ]; then
echo `hostname -f`
. /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
When I log into this host, it echoes the hostname correctly. But I've noticed that when I try to execute some shell script, I get errors until I run the ". /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env" manually.
Nothing appears to be incorrect with the syntax. Any idea why this isn't getting set correctly at my initial login?
Here's the entire contents of . /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
:
customfile=/appl_top/deverp/appl/customDEVERP_devoraebs01.env
if [ -f $customfile ]; then
. /appl_top/deverp/appl/customDEVERP_devoraebs01.env
fi
. /db/u01/conf_top/DEVERP_devoraebs01/8.0.6/DEVERP_devoraebs01.env
. /appl_top/deverp/appl/DEVERP_devoraebs01.env
I am logging into the host via PuTTY.
linux bash environment-variables profile
if [ `hostname` == "devoraebs01" ]; ?
– taliezin
Mar 12 '15 at 14:34
I don't think that's the fix. If it were, then my echohostname -f
would not run at login. But it does.
– Andrew Hummel
Mar 12 '15 at 14:38
and in your *.env file you are exporting something?
– taliezin
Mar 12 '15 at 14:51
1
Does the env file do an export of certain variables or a set?
– rahul
Mar 12 '15 at 14:57
1
Please edit your question and i) add the contents of/appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
(or, even better, just give us a minimal example that reproduces the problem) ii) explain how you log into the host since that changes what files are read at login.
– terdon♦
Mar 12 '15 at 14:58
|
show 7 more comments
I have my bash_profile environment setting as follows:
if [ `hostname` = "devoraebs01" ]; then
echo `hostname -f`
. /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
When I log into this host, it echoes the hostname correctly. But I've noticed that when I try to execute some shell script, I get errors until I run the ". /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env" manually.
Nothing appears to be incorrect with the syntax. Any idea why this isn't getting set correctly at my initial login?
Here's the entire contents of . /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
:
customfile=/appl_top/deverp/appl/customDEVERP_devoraebs01.env
if [ -f $customfile ]; then
. /appl_top/deverp/appl/customDEVERP_devoraebs01.env
fi
. /db/u01/conf_top/DEVERP_devoraebs01/8.0.6/DEVERP_devoraebs01.env
. /appl_top/deverp/appl/DEVERP_devoraebs01.env
I am logging into the host via PuTTY.
linux bash environment-variables profile
I have my bash_profile environment setting as follows:
if [ `hostname` = "devoraebs01" ]; then
echo `hostname -f`
. /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
When I log into this host, it echoes the hostname correctly. But I've noticed that when I try to execute some shell script, I get errors until I run the ". /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env" manually.
Nothing appears to be incorrect with the syntax. Any idea why this isn't getting set correctly at my initial login?
Here's the entire contents of . /appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
:
customfile=/appl_top/deverp/appl/customDEVERP_devoraebs01.env
if [ -f $customfile ]; then
. /appl_top/deverp/appl/customDEVERP_devoraebs01.env
fi
. /db/u01/conf_top/DEVERP_devoraebs01/8.0.6/DEVERP_devoraebs01.env
. /appl_top/deverp/appl/DEVERP_devoraebs01.env
I am logging into the host via PuTTY.
linux bash environment-variables profile
linux bash environment-variables profile
edited Mar 13 '15 at 0:14
slm♦
255k71541687
255k71541687
asked Mar 12 '15 at 14:33
Andrew HummelAndrew Hummel
147
147
if [ `hostname` == "devoraebs01" ]; ?
– taliezin
Mar 12 '15 at 14:34
I don't think that's the fix. If it were, then my echohostname -f
would not run at login. But it does.
– Andrew Hummel
Mar 12 '15 at 14:38
and in your *.env file you are exporting something?
– taliezin
Mar 12 '15 at 14:51
1
Does the env file do an export of certain variables or a set?
– rahul
Mar 12 '15 at 14:57
1
Please edit your question and i) add the contents of/appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
(or, even better, just give us a minimal example that reproduces the problem) ii) explain how you log into the host since that changes what files are read at login.
– terdon♦
Mar 12 '15 at 14:58
|
show 7 more comments
if [ `hostname` == "devoraebs01" ]; ?
– taliezin
Mar 12 '15 at 14:34
I don't think that's the fix. If it were, then my echohostname -f
would not run at login. But it does.
– Andrew Hummel
Mar 12 '15 at 14:38
and in your *.env file you are exporting something?
– taliezin
Mar 12 '15 at 14:51
1
Does the env file do an export of certain variables or a set?
– rahul
Mar 12 '15 at 14:57
1
Please edit your question and i) add the contents of/appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
(or, even better, just give us a minimal example that reproduces the problem) ii) explain how you log into the host since that changes what files are read at login.
– terdon♦
Mar 12 '15 at 14:58
if [ `hostname` == "devoraebs01" ]; ?
– taliezin
Mar 12 '15 at 14:34
if [ `hostname` == "devoraebs01" ]; ?
– taliezin
Mar 12 '15 at 14:34
I don't think that's the fix. If it were, then my echo
hostname -f
would not run at login. But it does.– Andrew Hummel
Mar 12 '15 at 14:38
I don't think that's the fix. If it were, then my echo
hostname -f
would not run at login. But it does.– Andrew Hummel
Mar 12 '15 at 14:38
and in your *.env file you are exporting something?
– taliezin
Mar 12 '15 at 14:51
and in your *.env file you are exporting something?
– taliezin
Mar 12 '15 at 14:51
1
1
Does the env file do an export of certain variables or a set?
– rahul
Mar 12 '15 at 14:57
Does the env file do an export of certain variables or a set?
– rahul
Mar 12 '15 at 14:57
1
1
Please edit your question and i) add the contents of
/appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
(or, even better, just give us a minimal example that reproduces the problem) ii) explain how you log into the host since that changes what files are read at login.– terdon♦
Mar 12 '15 at 14:58
Please edit your question and i) add the contents of
/appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
(or, even better, just give us a minimal example that reproduces the problem) ii) explain how you log into the host since that changes what files are read at login.– terdon♦
Mar 12 '15 at 14:58
|
show 7 more comments
1 Answer
1
active
oldest
votes
.bash_profile does not get executed for non-login shells, so if you are running a command and expect it to load in env settings from .bash_profile, that will not happen.
Try creating a .bashrc file instead.
So I created a file called .bashrc in my home directory and moved my env settings script into there. Does not appear to run after login. Am I missing something?
– Andrew Hummel
Mar 13 '15 at 12:51
I also added this to my .bash_profile to have it call .bashrc on login. It calles it but still not setting the env variable.
– Andrew Hummel
Mar 13 '15 at 13:26
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
– Andrew Hummel
Mar 13 '15 at 13:26
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f189743%2fenvironment-variables-not-getting-set-in-bash-profile%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
.bash_profile does not get executed for non-login shells, so if you are running a command and expect it to load in env settings from .bash_profile, that will not happen.
Try creating a .bashrc file instead.
So I created a file called .bashrc in my home directory and moved my env settings script into there. Does not appear to run after login. Am I missing something?
– Andrew Hummel
Mar 13 '15 at 12:51
I also added this to my .bash_profile to have it call .bashrc on login. It calles it but still not setting the env variable.
– Andrew Hummel
Mar 13 '15 at 13:26
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
– Andrew Hummel
Mar 13 '15 at 13:26
add a comment |
.bash_profile does not get executed for non-login shells, so if you are running a command and expect it to load in env settings from .bash_profile, that will not happen.
Try creating a .bashrc file instead.
So I created a file called .bashrc in my home directory and moved my env settings script into there. Does not appear to run after login. Am I missing something?
– Andrew Hummel
Mar 13 '15 at 12:51
I also added this to my .bash_profile to have it call .bashrc on login. It calles it but still not setting the env variable.
– Andrew Hummel
Mar 13 '15 at 13:26
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
– Andrew Hummel
Mar 13 '15 at 13:26
add a comment |
.bash_profile does not get executed for non-login shells, so if you are running a command and expect it to load in env settings from .bash_profile, that will not happen.
Try creating a .bashrc file instead.
.bash_profile does not get executed for non-login shells, so if you are running a command and expect it to load in env settings from .bash_profile, that will not happen.
Try creating a .bashrc file instead.
answered Mar 13 '15 at 1:59
Klaatu von SchlackerKlaatu von Schlacker
2,337710
2,337710
So I created a file called .bashrc in my home directory and moved my env settings script into there. Does not appear to run after login. Am I missing something?
– Andrew Hummel
Mar 13 '15 at 12:51
I also added this to my .bash_profile to have it call .bashrc on login. It calles it but still not setting the env variable.
– Andrew Hummel
Mar 13 '15 at 13:26
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
– Andrew Hummel
Mar 13 '15 at 13:26
add a comment |
So I created a file called .bashrc in my home directory and moved my env settings script into there. Does not appear to run after login. Am I missing something?
– Andrew Hummel
Mar 13 '15 at 12:51
I also added this to my .bash_profile to have it call .bashrc on login. It calles it but still not setting the env variable.
– Andrew Hummel
Mar 13 '15 at 13:26
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
– Andrew Hummel
Mar 13 '15 at 13:26
So I created a file called .bashrc in my home directory and moved my env settings script into there. Does not appear to run after login. Am I missing something?
– Andrew Hummel
Mar 13 '15 at 12:51
So I created a file called .bashrc in my home directory and moved my env settings script into there. Does not appear to run after login. Am I missing something?
– Andrew Hummel
Mar 13 '15 at 12:51
I also added this to my .bash_profile to have it call .bashrc on login. It calles it but still not setting the env variable.
– Andrew Hummel
Mar 13 '15 at 13:26
I also added this to my .bash_profile to have it call .bashrc on login. It calles it but still not setting the env variable.
– Andrew Hummel
Mar 13 '15 at 13:26
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
– Andrew Hummel
Mar 13 '15 at 13:26
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
– Andrew Hummel
Mar 13 '15 at 13:26
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f189743%2fenvironment-variables-not-getting-set-in-bash-profile%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
if [ `hostname` == "devoraebs01" ]; ?
– taliezin
Mar 12 '15 at 14:34
I don't think that's the fix. If it were, then my echo
hostname -f
would not run at login. But it does.– Andrew Hummel
Mar 12 '15 at 14:38
and in your *.env file you are exporting something?
– taliezin
Mar 12 '15 at 14:51
1
Does the env file do an export of certain variables or a set?
– rahul
Mar 12 '15 at 14:57
1
Please edit your question and i) add the contents of
/appl_top/deverp/appl/APPSDEVERP_devoraebs01.env
(or, even better, just give us a minimal example that reproduces the problem) ii) explain how you log into the host since that changes what files are read at login.– terdon♦
Mar 12 '15 at 14:58