LinuxQuestions.org
Review your favorite Linux distribution.
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 08-15-2009, 03:43 AM   #1
shady_abdelwahed
LQ Newbie
 
Registered: Aug 2009
Posts: 1

Rep: Reputation: 0
Which shell am I running? And, how to change it?


Hello All,

when I open a terminal window and type "echo $0", the answer is "bash". When I type "echo $SHELL", the answer is /bin/bash.

Now, setting aside that I want to change the login shell permanently, I have tried the following command: "chsh -s /bin/tcsh", and after entering my password, I get the message "Shell not changed", although tcsh is in /bin/tcsh.

However, when I just type "tcsh" on the terminal shell, and type "echo $0" I get "tcsh". But, when I type "echo $SHELL", I still get /bin/bash".

Also, when I type "grep ^username /etc/passwd", I get the following:

<username>:x:500:500:<full_name>:/home/<username>:/bin/tcsh

Now, I don't understand what's happening? And, how can I change my login shell either temporarily or for good? And, how to really know which shell I am using?

Also, since I assume I am running bash at login, I understand from the bash man page that the first file the system (or, whatever) looks at is the /etc/profile. I searched for it, and I found it. I am listing it's contents hereunder in case someone needs it to help identify the problem.

Quote:
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|: )$1($|: )" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
EUID=`id -u`
UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
pathmunge /sbin after
fi

if [ -x /usr/bin/id ]; then
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi

HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done

unset i
unset pathmunge

Thanks in advance.

Last edited by shady_abdelwahed; 08-15-2009 at 03:49 AM. Reason: a mis-interpreted command, which resulted in an unwanted smiley face.
 
Old 08-15-2009, 06:06 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Change the 7th (usually last) field for your user in /etc/passwd
 
Old 08-15-2009, 06:10 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
For safer ways see this thread. I guess I'm just a root-hacking primitive at heart
 
Old 08-15-2009, 07:54 AM   #4
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Rep: Reputation: 38
well when tpe the new shell for example suppose you are currently working on bash shell and you want to go into tcsh . For temporary just tpe the comman tcsh. it will put you into tcsh shell. If you want to come back again to your original shell that is bash shell for this type type exit and again you will be back to your original shell.

And yes for permanent entry our password file entry is must. Also you have modify your environment variable.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to change from one shell to another? cll975dll Linux - Newbie 3 08-15-2009 02:51 AM
running a shell script which invokes another shell program!!! raghu123 Programming 1 08-04-2008 10:10 AM
Can't change shell in plink shell script? lhouk Programming 2 08-02-2007 03:47 PM
Shell won't change! jaykup Linux - Newbie 2 05-11-2007 08:20 AM
shell script + change shell && continue darkRoom Programming 6 02-25-2005 03:50 AM


All times are GMT -5. The time now is 08:55 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration