Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Why at the login bash read .profile before .bash_login ?

user-image
Question ajoutée par R e n z o V i d o n i , Consultant , Various
Date de publication: 2015/09/17
Adel Abdel Hamid
par Adel Abdel Hamid , TSM technical support specialist , IBM

from

http://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

 

"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 behavior."

 

 

Patrick O''Leary
par Patrick O''Leary , CEO, CTO, Founder , eWitness, LLC

The login will get executed1 time at login, profiles gets executed with every shell/script that you run.

the login is read last to give you the chance to override the profile one knee only one time at login.

YASSER GHAREEB
par YASSER GHAREEB , Graphic Designer , NEW VISION

  1.  BUT BELIEVE IN GUP
  2. MORE MONEY 

Sonny Wenfred Lafuente
par Sonny Wenfred Lafuente , System Engineer , Entropy Solution Pte Ltd.

To check permissions and environment variables.

KHAJA AHSAN KHAN
par KHAJA AHSAN KHAN , Associate Director , Hilton World Wide

the .profile gets executed first and then the .bash_login.

Huzefa Akhter
par Huzefa Akhter , Head of IT Department , Wethaq Takaful Insurance Co

As linux is highly flexible, users are given an opportunity to change the name and location of envioronment setting files (even have a same file for multiple users), but as bash needs a pointer to start with, that pointer is hardcoded to be .profile 

dhakr qayid sufyan saeid الحبشي
par dhakr qayid sufyan saeid الحبشي , موضف شركة صرافه , الإمام للصرافة

Login will be executed once upon login, and

Sourav Bose
par Sourav Bose , Unix Infrastructure Administrator , Wipro Technologies

Because all enviromanetal varible updates along with reboot and stores in .profile file.

Priyanka Chavan
par Priyanka Chavan , System Analyst/Senior System Engineer , Infosys

.profile file process before .bash_login to accomodate both interactive and non-interactive sessions

Thomas Siju
par Thomas Siju , Service Engineer , Southern Naval Command

When the bash script executed in specific  log in shell then it runs required profile commands which exists

Ahmed Sayed
par Ahmed Sayed , Embedded Systems Software Developer , freelancer

because .profile extension is used for files in terminal programs, profile file in Linux comes under the System startup files(defines user environment after reading the initialization files that you have set up when you log in to shell).

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?