help me to understand the below highlighted:

When the login program executes a shell, that shell is uninitialized. When a shell is uninitialized, important
parameters required by the shell to function correctly are not defined.
The shell undergoes a phase called initialization to set up these parameters. This is usually a two step
process that involves the shell reading the following files:
l /etc/profile
l profile
The process is as follows:
1. The shell checks to see whether the file /etc/profile exists.
2. If it exists, the shell reads it. Otherwise, this file is skipped. No error message is displayed.
3. The shell checks to see whether the file .profile exists in your home directory. Your home
directory is the directory that you start out in after you log in.
4. If it exists, the shell reads it; otherwise, the shell skips it. No error message is displayed.
As soon as both of these files have been read, the shell displays a prompt:

I,m confused with the below statement. I would like to know if the below said is true then when is the shell initialized?

When the login program executes a shell, that shell is uninitialized.

It is a temporary state of the shell. The steps are as the man page quote says:

  1. The shell program starts (it is not yet initialized)
  2. /etc/profile is sourced if it exists (it is partly initialized)
  3. $HOME/.profile is sourced if it exists (it is fully initialized)
  4. Now a prompt is displayed (it is fully initialized)
  5. You may interact with the shell now

Edited 5 Years Ago by griswolf: n/a

"shell is uninitialized" means that the files (scripts) listed there (/etc/profile, ...) are NOT executed. So whatever env variables you're setting/updating in those files are not set/updated.

Edited 5 Years Ago by thekashyap: n/a

This article has been dead for over six months. Start a new discussion instead.