Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new shell after login?

Status
Not open for further replies.

tech84

Technical User
May 18, 2000
126
0
0
US
I'm reading that some shells use a different user initialization file at login and "when a new shell is started after login." What does it mean to start a new shell after login? I thought that you log in to a certain shell, and you could change that shell, but you had to log out and back in for the change to take affect. Can someone straighten me out on this, please? Thanks! Mike
[morning]
 
You can change the shell you are using. eg. if you login with your default shell being the bourne shell and enter csh you will be changed to a cshell.
 
the program which handle "logins" (owned by
root) will start a subprocess (owned by you)
using the shell (the program) given in the
passwd entry for you. This process is the
root of all your successives processes. One
of them can be another shell.
 
Sorry... I'm still not following. Say, for instance, that I'm logged into CDE via my default shell, bash. How would I start a new shell session, and why would I want to? I apologize for my ignorance, but I want to fully understand this and I'm a newbie. Can you suggest some man pages for me to look at? I tried man shell, but that didn't tell me much. Then I tried man -k shell, and there were about three pages of commands to choose from.

Thanks! Mike
[morning]
 
From your terminal window type

csh

You are now running the 'c' shell. To exit back to bash,

exit

If you create a file called $HOME/.cshrc , it will execute when you enter the csh command. For more help :-

man csh

Why so many shells? Because the original Bourne shell (sh) lacks alot of usability and programming features. I use bash (Born Again SHell) as it has many improvements to sh and contains alot of good bits from other shells like csh.
 
tech84,

From the previous posts, I'm assuming that you now understand how to start another shell from your current shell. A few additional comments regarding this:

- in order for a different shell to be used each time you log in, it needs to be defined in the passwd file or in your current shell's initialization file

- you can use the "ps" command (list your processes) to see what shell you are running

- it may help you understand what is going on if you perform the following sequence of commands:
1) login to a system
2) run "ps" to see what shell you are currently running
3) start another shell from the current shell (use a different shell than the one you are currently running)
4) run "ps" again to see what shells you are running
5) type "exit" to leave the new shell you started
6) run "ps" again to see what you are left with

Regarding your question about why someone would want to start a second shell...

If you have a shell script (a collection of multiple commands in a single file) that contains an exit statement, it is common to run the shell script in a second shell so that you will not be logged out when the shell comes to the exit statement.

It is also common to run the shell script in what's call the background so that you can continue working in the foreground. This is especially useful when you are running a script that may take a long time to complete (e.g. extracting data from a database).

Hope this helps some!

Biker
Systems/Network Administrator
LiveFire Labs - Hands-On Technical e-Learning
 
Thanks, Solituk and Biker! I now understand the whole multiple shell concept. I appreciate your responses to my inquiry.

Take care! Mike
[morning]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top