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:

Recommended Answers

All 5 Replies

Mhm. Where are you going with this?

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.

What is uninitialized shell when login program executes.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.