LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-02-2006, 09:39 AM   #1
konathamsrinu
LQ Newbie
 
Registered: Jul 2006
Posts: 5

Rep: Reputation: 0
export is not working in .bashsrc


Hi everybody,
I am new to linux and
I am trying to put a env variable in .bashrc like the below.
export HOME=/export/apps/actuate

After relogin, my home directory still shows the old one.

Am i doing some thing wrong or some thing wrong in the env. setting.
Do i need to execute some thing before modifying this.
any help would be appreciated.
I am using Linux version
Linux etsln33.ets.org 2.4.21-40.ELsmp #1 SMP Thu Feb 2 22:22:39 EST 2006 i686 i686 i386 GNU/Linux

Thanks and Regards
Srinivas
 
Old 11-02-2006, 09:46 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400
Hi,

HOME is a reserved word. For details see man bash

In short: Don't use it, it's used by bash itself.

Hope this helps.
 
Old 11-02-2006, 09:53 AM   #3
JiYu
LQ Newbie
 
Registered: Sep 2006
Location: Germany
Distribution: FreeBSD
Posts: 29

Rep: Reputation: 15
For a New Homedirectory you should be look in the /etc/passwd
 
Old 11-02-2006, 10:24 AM   #4
konathamsrinu
LQ Newbie
 
Registered: Jul 2006
Posts: 5

Original Poster
Rep: Reputation: 0
not only HOME, nothing is working in .bashrc

Thanks for the quick reply,

None of the words entered in .bashrc is not working, not only HOME.

I think it's not executing the .bashrc, when i login, How can i execute when i login
I was reading other postings. all the varaibles are showing correctly, if i execute /bin/bash, Not sure how to make this as a login script,

shopt login_shell gives me this out put
login_shell off


Thanks and Regards,
Srinivas
 
Old 11-02-2006, 10:34 AM   #5
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
That's why it is not unusual to have a ~/.bash_profile which contains :

Code:
[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
 
Old 11-02-2006, 10:34 AM   #6
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Have you tried putting the info in ~/.bash_profile and not ~/.bashrc.
 
Old 11-02-2006, 10:40 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400
Hi,

What are you actually trying to do?
Start a shell, a (x)term, a script or do a login?

If and when the ~/.bashrc file is read depends on some things. man bash (the INVOCATION part) explains all this.
 
Old 11-02-2006, 10:43 AM   #8
konathamsrinu
LQ Newbie
 
Registered: Jul 2006
Posts: 5

Original Poster
Rep: Reputation: 0
No Luck

Hi,

Thank you very much for all of your help, But it's not working.

[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
This line is already there in the .bash_profile

I tried putting the info in the .bash_profile, but no luck,

I tried to execute the /bin/bash. after that my .bashrc file seems to be working.
How can i execute this /bin/bash when i login

Thanks and Regards
Srinivas
 
Old 11-02-2006, 10:47 AM   #9
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Maybe bash is not your default shell ? check /etc/passwd to make sure
 
Old 11-02-2006, 10:50 AM   #10
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400
Hi,

If you already have a shell and want to start a (new) interactive bash shell: bash -l
 
Old 11-02-2006, 10:57 AM   #11
konathamsrinu
LQ Newbie
 
Registered: Jul 2006
Posts: 5

Original Poster
Rep: Reputation: 0
hmm, It's not bash, it's ksh !!!!

Hi,

I checked the /etc/passwd file, /bin/bash is not the defalt script, it's /bin/ksh

Can i some how execute the /bin/bash when i login, since i do not have the previleges to modify the /etc/passwd file.
Or what is the alternative to ksh files like .bashrc

Thanks and Regards
Srinivas
 
Old 11-02-2006, 07:12 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,847

Rep: Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584
iirc, for ksh it's .profile. You can put any amendments in there.
 
Old 11-03-2006, 01:34 PM   #13
soggycornflake
Member
 
Registered: May 2006
Location: England
Distribution: Slackware 10.2, Slamd64
Posts: 249

Rep: Reputation: 31
Quote:
Originally Posted by druuna
Hi,

HOME is a reserved word. For details see man bash

In short: Don't use it, it's used by bash itself.

Hope this helps.
This is illogical, captain. HOME is not a reserved word (it's not even a "word", it's an environment variable), you can (re)set it to whatever you want. And it's initially set by login, not the shell.

Quote:
Originally Posted by konathamsrinu
Can i some how execute the /bin/bash when i login
Code:
chsh -s /bin/bash
It will ask you to enter your password. Also, the specified shell must be listed in /etc/shells.
 
Old 11-03-2006, 02:40 PM   #14
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400
Hi,

@soggycornflake:

Quote:
This is illogical, captain. HOME is not a reserved word (it's not even a "word", it's an environment variable), you can (re)set it to whatever you want. And it's initially set by login, not the shell.
Yes, it's a shell environment variable and strickly not a reserved word but it is set by the shell as stated in the manpage about these variables: The following variables are set by the shell:.

And yes you can set it to anything you want, but some applications/programs rely on it and that's why it's best to consider this a reserved word and one should not change it without good reason. Again from the same part of the manpage: The following variables are used by the shell. In some cases, bash assigns a default value to a variable; these cases are noted below..

BTW it's druuna, not captain
 
Old 11-03-2006, 03:21 PM   #15
soggycornflake
Member
 
Registered: May 2006
Location: England
Distribution: Slackware 10.2, Slamd64
Posts: 249

Rep: Reputation: 31
Quote:
Originally Posted by druuna
Yes, it's a shell environment variable and strickly not a reserved word but it is set by the shell as stated in the manpage about these variables: The following variables are set by the shell:.
Hmm, checked bash man page, it indeed claims to set HOME, for some reason. From login man page:

Quote:
Your user and group ID will be set according to their values in the /etc/passwd file. The value for $HOME, $SHELL, $PATH, $LOGNAME, and $MAIL are set according to the appropriate fields in the password entry.
Thus, HOME is set by login. I don't know why the bash man page claims that the shell sets it (zsh man page says it _uses_ HOME, not that it sets it). Maybe bash sets it again anyway, just to be paranoid.

Quote:
Originally Posted by druuna
And yes you can set it to anything you want, but some applications/programs rely on it and that's why it's best to consider this a reserved word and one should not change it without good reason. Again from the same part of the manpage: The following variables are used by the shell. In some cases, bash assigns a default value to a variable; these cases are noted below..
Agreed. I was just pointing out that technically, it's not special (as opposed to say, $UID, which you can't change).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
export cd variable? rjwhite Linux - Games 1 12-17-2005 05:47 PM
Export Shell Variable not working maxhugen Linux - Newbie 6 01-06-2005 10:12 PM
export LD_LIBRARY_PATH Pedroski Linux - Software 7 01-01-2005 04:06 AM
can not export per nfsd blish_blash *BSD 1 12-26-2004 01:13 PM
export cmd gamor Linux - Newbie 6 11-21-2004 01:55 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration