LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-18-2011, 12:56 PM   #1
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Rep: Reputation: 53
BASH Shell Differences: Login or Interactive


Intuitively I think that the Login Shell and the Interactive Shell are the same applications but have access to different environmental variables.It this true? Why is there more than one type of shell anyways? You can change users with the interactive shell, why not log on with it to?

Thanks in advance!
 
Old 02-18-2011, 01:53 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by theKbStockpiler View Post
Intuitively I think that the Login Shell and the Interactive Shell are the same applications but have access to different environmental variables.It this true?
No. Please check 'man bash', the "Invocation" part.


Quote:
Originally Posted by theKbStockpiler View Post
Why is there more than one type of shell anyways?
Different tasks have different needs. After you initialized a login shell you don't want to keep logging in and some tasks, like starting a service or running an at or cronjob, run without terminal.
 
1 members found this post helpful.
Old 02-18-2011, 05:00 PM   #3
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
I read the whole section on Invocation and....

Thanks for the reply! I would like to establish that when I use the term (Application) I'm referring to a specific piece of software and not a (Process) , an instance of an application. I don't see anything in my specific BASH manual that seems to pertain to anything except BASH using different scripts for different purposes. There is no (BASH Login) application stored anywhere with another (Bash Script) application somewhere else is there? So the same BASH application is run in different processes with different Environmental Variables. Correct?
 
Old 02-18-2011, 11:54 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Intuitively I think that the Login Shell and the Interactive Shell are the same applications but have access to different environmental variables.
It is the same executable, but called with different arguments.

Quote:
-l
Make this shell act as if it had been directly invoked by login. When the shell is interactive, this is equivalent to starting a login shell with ‘exec -l bash’. When the shell is not interactive, the login shell startup files will be executed. ‘exec bash -l’ or ‘exec bash --login’ will replace the current shell with a Bash login shell. See Bash Startup Files, for a description of the special behavior of a login shell.
...
A login shell is one whose first character of argument zero is ‘-’, or one invoked with the --login option.
Invoking Bash
Quote:
You can change users with the interactive shell, why not log on with it to?
What do you mean by change users?
 
Old 02-19-2011, 01:55 PM   #5
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
Thanks for the help!

Quote:
What do you mean by change users?
I mean you can change from Root to which ever profile that was created on your computer.
Quote:
[kbs@localhost ~]$ su
Password:
[root@localhost kbs]#
I assume that the login shell is the one that allows you to enter your user password for your own profile. I don't mean to be redundant in a facetious way but I don't get the confusion. Thanks again!
 
Old 02-19-2011, 05:19 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by theKbStockpiler View Post
I mean you can change from Root to which ever profile that was created on your computer.I assume that the login shell is the one that allows you to enter your user password for your own profile. I don't mean to be redundant in a facetious way but I don't get the confusion. Thanks again!
No, the su program asks for the password. If you are root, su won't ask for a password, it doesn't matter whether you are running a login shell or not. Don't worry about being redundant, I'm still not entirely sure I've understood your question.
 
1 members found this post helpful.
Old 02-20-2011, 01:25 PM   #7
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
It's all academic at this point. "Is that the correct saying?

I don't see the reasoning behind having more than one process of BASH run at the same time.I would think that how the instances of Bash access and store data could be handled some other way besides for isolating them to keep them separate. I do understand it enough and it is not all that important but I would be interested in knowing because I'm studying it at the present.

Thanks!

Last edited by theKbStockpiler; 02-20-2011 at 01:30 PM.
 
Old 02-20-2011, 08:07 PM   #8
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by theKbStockpiler View Post
I don't see the reasoning behind having more than one process of BASH run at the same time.
Um, if you start a second bash process you will have two processes running at the same time, I'm not sure what kind of "reasoning" you are looking for here...
 
Old 02-20-2011, 09:07 PM   #9
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
Talking Its not important . You have helped solve this thread and just to cure your curiosity.

Two separate processes running the same code with different Environmental Variables and storage files for all of these. This is too in-depth for most purposes but is the reasoning behind the question.
 
Old 02-20-2011, 11:53 PM   #10
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by theKbStockpiler View Post
Two separate processes running the same code with different Environmental Variables and storage files for all of these.
You haven't finished your thought here, what about those processes.

The environmental variables are indeed per process, but not the files.
 
Old 02-21-2011, 01:00 AM   #11
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by theKbStockpiler View Post
Two separate processes running the same code with different Environmental Variables and storage files for all of these. This is too in-depth for most purposes but is the reasoning behind the question.
Not really. About having different storage files you just have to separate working directories based from the process' PID. i.e.:

Code:
~/.program/$$/<files>
/var/local/program/$$/<files>
/var/cache/program/$$/<files>
... etc ...
$$ = running process' PID

$$ is valid in bash; not sure in other shells but there are many tricks to know that.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Differences in output between top in batch and interactive mode knockoutned Linux - General 2 07-13-2010 12:03 PM
setting a timeout in an interactive bash shell script steven.c.banks Linux - General 2 01-23-2009 04:07 PM
root won't use bash as login shell moob8 Linux - Software 9 10-28-2008 10:15 PM
login directly to bash shell openart Linux - Newbie 5 10-27-2004 08:05 AM
How to login to bash shell inarin Linux - Newbie 1 10-07-2003 02:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration