Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Apr 2002 16:08:35 -0600
From:      Scott Corey <scott@Amelia.bsdprophet.org>
To:        dillama <dillama1@excite.com>
Cc:        freebsd-newbies@FreeBSD.ORG
Subject:   Re: Difference between .cshrc and .profiles
Message-ID:  <20020406220835.GA46758@bsdprophet.org>
In-Reply-To: <20020406202704.36C06B6B6@xmxpita.excite.com>
References:  <20020406202704.36C06B6B6@xmxpita.excite.com>

next in thread | previous in thread | raw e-mail | index | archive | help
As a normal login shell, bash 'sources' system-wide file /etc/profile, whrer the system environment and path can be set for bash users. However, it is not run when the system interprets the shell as non-interactive. The most important case would be single user mode, where csh is executed on the machine. The /etc/profile is not run and the path is inherited from the csh daemon.

bash receives command line arguments -login and -i that can be used to set as a login shell or interactive shell respectively.

The user can overwrite values set in /etc/profile by creating a file ~/.bash_profile, ~/bash_login or ~/.profile. Note that just the first one of these is executed thus differing of the logic of csh initialization. ~/bash_login is not executed specially for login shells and if .bash_profile exists, it is not executed at all!

If bash is used with name sh instead of the name bash, it emulates original Bourne shell initialization: it sources just files /etc/profile and ~/.profile and just for login shells.

As a login shell tcsh executes the following files in this order:
/etc/csh.cshrc
/etc/csh.login
~/.tschrc
~/.cshrc (if .tschrc is not found)
~/.history
~/.login
~/.cshdirs

tsch can be compiled to execute login scripts before cshrc scripts. Beware!

Non-interactive shells execute just the "cshrc scripts" login scripts can be used to set the path just once in the login.

Hope this helps.

On Sat, Apr 06, 2002 at 03:27:04PM -0500, dillama wrote:
> 
> Can anyone explain the difference between .cshrc and .profile? They are so similar.
> 
> 
> 
> ------------------------------------------------
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-newbies" in the body of the message

-- 
Scott B. Corey
scott@bsdprophet.org
irc.openprojects.net #bsdprophet

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020406220835.GA46758>