Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
How to check if a shell is login/interactive/batch

And what's the benefits of non-login shell over login shell?

share|improve this question

marked as duplicate by jasonwryan, Mat, Gilles, Renan, Caleb Nov 25 '12 at 23:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
See also Difference between Login Shell and Non-Login Shell? –  Gilles Nov 25 '12 at 20:47

1 Answer 1

You can tell whether you're in a login shell using shopt:

dennis@lightning:~$ shopt login_shell
login_shell     off

As for the benefits: login shells generally do a bit more initialization (such as setting environment variables and cd'ing into $HOME) which aren't necessary for other shells. On the other hand, by default any shell launched from the gui is not a login shell, so most people configure their shell initscripts (~/.bashrc etc) to do all initialization for both login and non-login shells.

share|improve this answer
1  
Yes for bash the configuration is often done in ~/.bashrc which is sourced in ~/.bash_profile to make life easier. –  peterph Nov 25 '12 at 18:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.