The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Platform Initialization Self-Certification Test 20080120 (Default branch) iBot Software Releases - RSS News 0 02-28-2008 01:10 AM
Writing a shared library --- any initialization routine? rogeryin UNIX for Dummies Questions & Answers 1 06-22-2006 08:17 PM
Initialization & Startup Files aldowsary AIX 2 02-14-2006 06:32 AM
Help regarding storing the initialization parameters VENC22 UNIX for Dummies Questions & Answers 1 05-16-2005 12:16 PM
Struct Initialization amatsaka High Level Programming 4 12-20-2002 07:25 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 02-20-2007
Registered User
 

Join Date: Oct 2006
Location: San Jose, CA
Posts: 11
Shell initialization files

As you know, when a user logs in, the shell reads the initialization files in an order something like below...

###################
Bourne Shell
/etc/profile > $HOME/.profile

Bash Shell
/etc/profile > $HOME/.bash_profile > $HOME/.bash_login > $HOME/.profile > $HOME/.bashrc

C Shell
/etc/.login > $HOME/.cshrc > $HOME/.login > $HOME/.cshrc

Korn Shell
/etc/profile > $HOME/.profile > $HOME/.kshrc
###################

So I'm just wondering,.. why are there so many initialization files needed? Is it just me, or does it seem like this is an overly complicated way of initializing account profile settings? And please forgive me ahead of time for not understanding as I am still relatively new at this.
Reply With Quote
Forum Sponsor
  #2  
Old 02-21-2007
Registered User
 

Join Date: May 2006
Location: England
Posts: 265
Yes but I think you are missing one point! You do not need to execute all of them! The system will run quite happily with just the profile. You can then set variables local to the user with the .profile / .kshrc etc. It is all a matter of control. You forgot /etc/environment.
Reply With Quote
  #3  
Old 02-21-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,618
There is typically a "at login" script which is executed only by a login shell. A login shell will have a name starting with a hyphen. Then shells may have a secondary startup file that is executed by every shell (the login shell and any subshells) where stuff like aliases may be defined. For each file, there is a version in /etc which is systemwide and may be all you need. After the verion in /etc runs, the shell runs the version in $HOME. This gives the user a chance to override and systemwide settings.

bash needs to be able to emulate the bourne shell so it checks the bourne shell's files as well.
Reply With Quote
  #4  
Old 02-22-2007
Registered User
 

Join Date: Oct 2006
Location: San Jose, CA
Posts: 11
Right, but the thing I don't get is why is there so many? For instance, I can see the reasoning behind having one default one and then maybe a second one for the user account. But like bash for instance has .bashrc, .bash_profile, .bash_login, etc. And I know that it's not necessary to use all of them but it just seems like it overly complicates things to have so many available. Then not to mention, that's just for UNIX,... Linux distributions have even more. Maybe I'm still too new to this, but it seems like it would make more sense to standardize this system to all shells and all platforms.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0