LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-24-2008, 12:40 PM   #1
hocheetiong
Member
 
Registered: Jul 2007
Location: Penang , Malaysia.
Distribution: red hat linux
Posts: 133

Rep: Reputation: 15
Smile command to temporary change current shell.


At my /etc/passwd file user1 using /bin/bash as a default login shell.
user1:x:602:603::/home/user1:/bin/bash

so once i login user1, i am using bash shell. ok how to temporary change my current shell bash to korn or other shell.

$tcsh
this command to temporary change current bash shell TC shell.

$chsh
this command to permanant change login shell.

problem:
1. command tcsh ,i am in RHEL5 than can be use, but other linux os may cannot been use, or sunOS also cannot use.

2. Any other common command to suitable for all linx or UNIX OS to temporary change shell and permanant change shell?


Thank.
 
Old 04-24-2008, 01:07 PM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
You can, simply, change shells by executing the shell program; e.g., if you're login shell is BASH, you can change to C-shell by typing chs or Korn shell by typing ksh.

Now, here's the rub: doing that does not load the content of .login (in the case of C-shell) or .profile (and, possibly, .kshrc) in the case of Korn shell. It's possible that both C-shell and Korn shell will inherit any environment variables set by the initial BASH login but I wouldn't want to count on that in every situation. If you only need to temporarily change shells to run, say, a shell program, it would be much better (and more reliable) to embed #!/bin/shelname as the first line of your shell program; e.g., #!/bin/chs, #!/bin/ksh, etc. and set any special environment variables in the shell program.
 
  


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
Temporary Disable History Command leebrent Linux - Security 1 02-11-2008 08:54 PM
BASH shell temporary history WingnutOne Linux - Newbie 10 09-16-2007 01:37 AM
Temporary storage of password in shell script ansbaradigeidfran Programming 9 10-25-2006 09:03 AM
how do i change the current prompt in shell? prospekrisal Linux - Newbie 4 07-16-2006 10:35 AM
how can I change the current shell on the fly? Xavius Linux - Newbie 5 04-06-2004 08:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:25 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