Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Unix&Linux>>.bashrc not being executed?

.bashrc not being executed?

giskard22
04-02-2004, 01:50 PM
I upgraded to 10.3 some time ago, but since I didn't do a clean install my existing user was still set to tcsh for its default shell. Since the 10.3 default is bash, I decided to change my shell using NetInfo. So now I'm using bash, but it doesn't execute my .bashrc file. The only thing I have in there is 1 alias command. The command works fine when typed manually into a running shell, but it's never there automatically.

Any ideas? I use the CLI for stuff like concatenating files but don't mess around with anything behind the scenes. Everything should be "clean". The official GNU bash manual doesn't seem to specificy any special format for the .bashrc file.

Thanks all!

scaryfish
04-02-2004, 02:46 PM
Try sticking
~/.bashrc
in /etc/bashrc - that worked for me (each users .bashrc doesn't get run by default).

giskard22
04-02-2004, 03:04 PM
Ok, tried it. After I made the modification, the next shell I opened gave me a "permission denied" error at the top. So I added user execute permission to .bashrc. This time the error went away, but the alias still wasn't made.

Is there some special format required for the .bashrc file? Mine is the following (in its entirety):
alias dir="ls -al"

mervTormel
04-02-2004, 04:57 PM
what you want to do is load the ~/.bashrc file from ~/.bash_profile


if [ -f ~/.bashrc ]; then source ~/.bashrc ; fi
the source command reads and executes the commands in the file specified

if you don't have ~/.bash_profile, create it.

refer to man bash 'invocation' section where, after deciphering, you'll know that login shells (what's that?) "sources" the file at ~/.bash_profile and that subshells (huh?) source ~/.bashrc

so, a login shells need to specifically source ~/.bashrc

subshells don't load ~/.bash_profile, they load ~/.bashrc

--
if it were easy, we wouldn't call it code, and this is easy when you know how it works

;]

giskard22
04-02-2004, 05:02 PM
Thanks, that works.

I remembering seeing that sort of thing in the material I read online. The missing link for me was in defining what a "login shell" is versus a regular "interactive shell". It sounds like the first shell created through a particular Terminal window is a login shell, which makes sense if you ignore that fact that you've logged into the computer via a GUI also. :)


 

TOP

Windows Server Outsell
Unix Signals And C++ E

For more info

Unix Signals And C++ E
Windows Server Outsell
ssh setup for password
Bash script does not w
esc code 
ARD send unix command 
question about binarie
Scanning mail 
Issuing multiple comma
How do I install Linux

News Archive

/etc/hosts? 
Manually Start a Start
mounting missed hard d
Using Netinfo in Singl
darwin/bsd login probl
system_profiler and fi
Send mail from script 
mounting a drive 
OS X disk first aid ha
system.log shows steal

Related stories:

Authenticating from command-line when "su user ..."
Scanning mail
Get a Tab Del File from ls output
Extracting CPIO archive
Unmounting
CpMac
Problems installing from source

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics