Confused with echo $SHELL Command....


 
Thread Tools Search this Thread
Operating Systems Solaris Confused with echo $SHELL Command....
# 1  
Old 11-03-2008
Confused with echo $SHELL Command....

Hi.. Everyone...

Kindly consider following :

login as: root
Using keyboard-interactive authentication.
Password:
Last login: Mon Nov 3 19:30:50 2008 from xxxxxxxxxxx
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
You have new mail.
Sourcing //.profile-EIS.....
#
#
# pwd
/
#
# set
EDITOR=vi
HOME=/
IFS=

LC_COLLATE=en_US.ISO8859-15
LC_CTYPE=en_US.ISO8859-1
LC_MESSAGES=C
LC_MONETARY=en_US.ISO8859-15
LC_NUMERIC=en_US.ISO8859-15
LC_TIME=en_US.ISO8859-15
LD_LIBRARY_PATH=/usr/openwin/lib
LOGNAME=root
MAIL=/var/mail//root
MAILCHECK=600
MANPATH=:/usr/man:/usr/share/man:/opt/SUNWexplo/man:/opt/SUNWsneep/man:/opt/CTEact/man
OPENWINHOME=/usr/openwin
OPTIND=1
PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/platform/SUNW,Sun-Fire-T200/sbin:/opt/sun/bin:/opt/SUNWexplo/bin:/opt/SUNWsneep/bin:/opt/CTEact/bin
PS1=#
PS2=>
SHELL=/sbin/sh
SSH_CLIENT=xxxxxxxxxxx
SSH_CONNECTION=xxxxxxxxxxx

SSH_TTY=/dev/pts/1
TERM=xterm
TZ=xxxxxxxxxx
USER=root
VMSA_BASE=/opt/VRTSvmsa
VXVM3_BASE=/opt/VRTSvxvm
VXVM_MAN=/opt/VRTS/man

#
#
#
# env
EDITOR=vi
HOME=/
LC_COLLATE=en_US.ISO8859-15
LC_CTYPE=en_US.ISO8859-1
LC_MESSAGES=C
LC_MONETARY=en_US.ISO8859-15
LC_NUMERIC=en_US.ISO8859-15
LC_TIME=en_US.ISO8859-15
LD_LIBRARY_PATH=/usr/openwin/lib
LOGNAME=root
MAIL=/var/mail//root
MANPATH=:/usr/man:/usr/share/man:/opt/SUNWexplo/man:/opt/SUNWsneep/man:/opt/CTEact/man
OPENWINHOME=/usr/openwin
PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/platform/SUNW,Sun-Fire-T200/sbin:/opt/sun/bin:/opt/SUNWexplo/bin:/opt/SUNWsneep/bin:/opt/CTEact/bin
PS1=#
PS2=>
SHELL=/sbin/sh
SSH_CLIENT=xxxxxxxxx

SSH_CONNECTION=xxxxxxxxx
SSH_TTY=/dev/pts/1
TERM=xterm
TZ=xxxxxxxxxx
USER=root

#
#
# echo $SHELL
/sbin/sh
#
# echo $0
-sh
#
# bash
#
# echo $SHELL
/sbin/sh

#
# echo $0
bash
#


What I want to ask is I logged in one of my system with -sh as default shell.Then I changed my shell with bash command and when I used
echo $SHELL command , it shows me /sbin/sh as shell, but echo $0
command is showing me bash.

Why echo $SHELL command is showing me /sbin/sh even when I haved changed to bash.

Thanks in Advance.....
# 2  
Old 11-03-2008
The SHELL variable is set at login - it doesn't know that you decided to change to bash later on.
# 3  
Old 11-03-2008
echo $SHELL - your default shell in passwd file

echo $0 - your current shell
# 4  
Old 11-04-2008
Thanks Everyone.....
Got the point.....
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Confused by the sed command

Hi Gurus, I am a little bit confused by the sed command. my file is below cat sample aaa bbb ccc ddd eee fff ggg hhh iii below is command and output. (6 Replies)
Discussion started by: ken6503
6 Replies

2. Shell Programming and Scripting

Confused by command substitution and quoting

How do I assign output of a command to a variable without expanding it? I have tried every combination of quoting I can think of including literal quotes in the command and user agent variable and still can't get it to work (or it breaks Lynx because Lynx tolorates spaces in the useragent but... (2 Replies)
Discussion started by: Michael Stora
2 Replies

3. Shell Programming and Scripting

Need to echo command successful if command is executed successfully

Hello, I have written a command n shell script : srvctl relocate service -d t1 -s s1 -i i1 -t t1 -f If the above command executes successfully without error I need to echo "Service relocated successfully and If it errors out I need to trap the errors in a file and also need to make... (1 Reply)
Discussion started by: Vishal_dba
1 Replies

4. Shell Programming and Scripting

How to echo output of a UNIX command (like ls -l ) using shell script.?

How do i echo the output of a unix command using shell script??? Like: echo /etc/ ls -l (2 Replies)
Discussion started by: sunny2802
2 Replies

5. UNIX for Dummies Questions & Answers

Confusion with echo command under csh shell

HI, guys, I am having some problem with the echo command, so I want to echo some text to a file name loginFile, the result inside the loginFile should looks like: expect ">" so what I did is: echo "expect "">""" >> $loginFile but it just gave out: expect > The thing is I still need... (2 Replies)
Discussion started by: warmboy610
2 Replies

6. UNIX for Dummies Questions & Answers

Confused over results using "tee" in piped command

First post here, so hopefully all guidelines are followed, and thanks in advance for any replies. I'm working on a shell script(BASH) that processes a csv file and performs various tasks with the data. All is well, except I want to use 'tee' to send output from 'wc' to a file as well as pipe it... (4 Replies)
Discussion started by: jazzmusic
4 Replies

7. Shell Programming and Scripting

SED - confused by the s command.

echo "abc 123" | sed 's/*/& &/g' output: a b c 123 123 Why there are spaces between the "abc" letters? echo "abc 123" | sed 's/*/&&/' output: abc 123 Why the regex in the above script does not match anything? I thought * should match 123 in any case. ---------- Post updated at 08:25... (3 Replies)
Discussion started by: kevintse
3 Replies

8. Shell Programming and Scripting

C Shell in linux.. only recognizes echo command

Hi guys, So my code is below. This is a simplified version of the shell... It does not continue for ever... I guess its actually rather a program to accept a command.. has the fork and the execve etc. Anyways when i compile it and run it in the terminal for some reason only '/bin/echo "enter... (1 Reply)
Discussion started by: 1bh
1 Replies

9. Shell Programming and Scripting

Shell and echo

Probably my first post, very new to shell scripting :) Here is the script i am trying to modify to use function # Script to create simple menus and take action according to that selected # menu item # while : do clear echo "-------------------------------------" echo "... (2 Replies)
Discussion started by: replyramdas
2 Replies
Login or Register to Ask a Question