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;








2















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.










share|improve this question
























  • 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

















2















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.










share|improve this question
























  • 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













2












2








2








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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

















  • 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
















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










1 Answer
1






active

oldest

votes


















0














.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.






share|improve this answer























  • 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











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
);



);













draft saved

draft discarded


















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









0














.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.






share|improve this answer























  • 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















0














.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.






share|improve this answer























  • 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













0












0








0







.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.






share|improve this answer













.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.







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.