"How do you identify your current shell?" is one of the frequently asked interview question.
Some would say "echo $SHELL" and some would say "echo $0". So, which is the right answer?
See for yourself!
Some would say "echo $SHELL" and some would say "echo $0". So, which is the right answer?
See for yourself!
root > grep ^root /etc/passwd
root:x:0:0:root:/root:/bin/bash
root > bash
root > echo $SHELL
/bin/bash
root > echo $0
-bash
root > ksh
root > echo $SHELL
/bin/bash
root > echo $0
ksh
Got it?$SHELL will always print the login shell. $0 will print the current shell.
Good Day!
Thanks boss
ReplyDeletewaht is commAND to find the login shell?
ReplyDeleteTo know the login shell, use echo $SHELL
DeleteTo know the current shell, use echo $0