Click to See Complete Forum and Search --> : .bash_profile and .profile


mka
01-10-2001, 12:37 AM
Just installed Storm. I like the look of it so far.

A few problems adjusting since I've used nothing but RH.

Users have .bash_profile and .bashrc.

Root has .bashrc and .profile.

What gives there? Anyone have any ideas? Is .profile same as .bash_profile, but just for root?


------------------
mka

George W. Bush: "A key to foreign policy is to rely on reliance."

ep0k
01-10-2001, 12:40 AM
I thought '.profile' was for the csh and tcsh?

pbharris
01-10-2001, 01:22 AM
yea, what ep0k said, but .bash_profile is fine for root.

mattmorrow
01-10-2001, 10:10 AM
Is there a Linux/Unix System Administrator that can explain the difference between these various configuration files? I've noticed over many years of Unix and now Linux, and under many shells, there always seems to be primarily 2: a profile of some sort, and a SHELLrc (like .cshrc or .bashrc). It's never been clear to me how they are distinct. Which one gets executed first? Is it necessary to call one from the other? I'm using ksh, and I have a .profile and a .kshrc, and I tend to mix and match what I put in them - which is probably not a good idea.
TIA, mm

Strike
01-10-2001, 11:09 AM
My solution (though probably not the wisest, but perfectly good for me):

rm .bash_profile
ln -s .bashrc .bash_profile

Then they are always the same http://www.linuxnewbie.org/ubb/smile.gif

henri
01-10-2001, 11:55 AM
The answer to your question is in "man bash"
under "INVOCATION"
I tried to cut'n'paste but it didn't work.

Strike
01-10-2001, 03:01 PM
On behalf of henri:

When bash is invoked as an interactive login shell, or as
a non-interactive shell with the --login option, it first
reads and executes commands from the file /etc/profile, if
that file exists. After reading that file, it looks for
~/.bash_profile, ~/.bash_login, and ~/.profile, in that
order, and reads and executes commands from the first one
that exists and is readable. The --noprofile option may
be used when the shell is started to inhibit this behav-
ior.

When a login shell exits, bash reads and executes commands
from the file ~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is
started, bash reads and executes commands from ~/.bashrc,
if that file exists. This may be inhibited by using the
--norc option. The --rcfile file option will force bash
to read and execute commands from file instead of
~/.bashrc.

mka
01-10-2001, 03:13 PM
Now what's the difference between an interactive login shell, a non-interactive shell, a login shell?

A little confused by that!

------------------
mka

George W. Bush: "A key to foreign policy is to rely on reliance."

mfghazi
01-11-2001, 11:11 PM
The following might be of interest! http://www.linuxnewbie.org/ubb/Forum1/HTML/013481.html

------------------
Ghazi, Muhammad Farhan

A_Lawn_GNOME
01-11-2001, 11:34 PM
Is there a way to switch the default shell from tcsh to bash? This is for my school UNIX account. I never had to deal with switching shells in Linux. tcsh is kind of annoying and I'd rather have good ole bash.

Craig McPherson
01-12-2001, 03:44 AM
An interactive shell is a login shell. When you type your username and password at a getty, the getty program checks /etc/passwd to see what your shell is, then spawns that shell, running it as your user account.

A noninteractive shell is what's run when a shell script is run. A shell script should have, at its very first line, something like #!/bin/sh that specifies what shell to run it with. When you run a shell script, a noninteractive copy of its shell is spawned, runs the script, then terminates. This is completely invisible to the user, there's no way to interact with this shell... hence, noninteractive.

A_Lawn_GNOME: Unless you can edit the /etc/passwd on the machine, you can't directly change your login shell. You can ask the administrator to change your shell, OR you can be a bit create, and simply have your tsch login script execute a copy of the bash shell, or just type "bash" after you log in.

Of course, you said UNIX, so I'll assume you're probably talking about a non-Linux system. Bash is a GNU utility and isn't available on most commercial Unix systems. However, bash (the Bourne Again Shell) is just a reimplementation of the Bourne Shell, which is universally /bin/sh on every UNIX system on the planet from now until the end of eternity. So you can just use the "sh" command to switch to the Bourne shell.

A_Lawn_GNOME
01-12-2001, 08:49 AM
I typed which bash and it said it was in /usr/bin/bash . Maybe it's not really bash but some other oddball thing floating around?

Well it doesn't matter a whole lot. I only use it when fiddling with my web site, which isn't very often.

Thanks Craig.

Strike
01-12-2001, 10:59 AM
Actually, chsh and ypchsh (for network-based logins using the "yellow pages") will allow normal users an opportunity to change their shells, assuming the shell you want is available in /etc/shells