SHELL environment variable still points to zsh after using bashdetermine shell in script during runtimeWhat sets the $SHELL environment variable?sharing or synchronizing history between Zsh and BashHow to view datetime stamp for history command in Zsh shellGlobbing fails in zsh, but works in bashCan't open shell after changing default shellSerialize shell variable in bash or zshConfigure tmux to use zshzsh HISTFILE - still read from ~/.zsh_historyA bash/zsh script isn't getting invoked from a terminal in FreeBsd, neither in bash nor in zshhow to put variable in CURL header using shell script?zsh PATH variable not properly set from another environment variable
Enchiridion, 16: Does a stoic moan, or not?
How to avoid typing 'git' at the begining of every Git command
How much web presence should I have?
Why did the World Bank set the global poverty line at $1.90?
Realistic, logical way for men with medieval-era weaponry to compete with much larger and physically stronger foes
Does it make sense to use a wavelet that is equal to a sine of one period?
That's not my X, its Y is too Z
What do you call the action of "describing events as they happen" like sports anchors do?
What is Gilligan's full Name?
Create a cube from identical 3D objects
Why would a home insurer offer a discount based on credit score?
If the pressure inside and outside a balloon balance, then why does air leave when it pops?
What is this object?
Why is it bad to use your whole foot in rock climbing
Can I use 220 V outlets on a 15 ampere breaker and wire it up as 110 V?
Do Veracrypt encrypted volumes have any kind of brute force protection?
Should I list a completely different profession in my technical resume?
What is this wall covering type?
Is there a better way to do partial sums of array items in JavaScript?
How to Convert an Object into Array in magento 2
Mathematica 12 has gotten worse at solving simple equations?
Course development: can I pay someone to make slides for the course?
What's the difference between DHCP and NAT? Are they mutually exclusive?
Was planting UN flag on Moon ever discussed?
SHELL environment variable still points to zsh after using bash
determine shell in script during runtimeWhat sets the $SHELL environment variable?sharing or synchronizing history between Zsh and BashHow to view datetime stamp for history command in Zsh shellGlobbing fails in zsh, but works in bashCan't open shell after changing default shellSerialize shell variable in bash or zshConfigure tmux to use zshzsh HISTFILE - still read from ~/.zsh_historyA bash/zsh script isn't getting invoked from a terminal in FreeBsd, neither in bash nor in zshhow to put variable in CURL header using shell script?zsh PATH variable not properly set from another environment variable
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to jump between zsh and bash.
By default, I have zsh as my shell, I can know this by typing:
echo $SHELL and I get /bin/zsh
However, I want to open Bash, so I type /bin/bash; I assume I am in bash now, but if I echo $SHELL I still get /bin/zsh
What's wrong, please?
bash shell zsh
add a comment |
I am trying to jump between zsh and bash.
By default, I have zsh as my shell, I can know this by typing:
echo $SHELL and I get /bin/zsh
However, I want to open Bash, so I type /bin/bash; I assume I am in bash now, but if I echo $SHELL I still get /bin/zsh
What's wrong, please?
bash shell zsh
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
Jun 4 at 20:34
add a comment |
I am trying to jump between zsh and bash.
By default, I have zsh as my shell, I can know this by typing:
echo $SHELL and I get /bin/zsh
However, I want to open Bash, so I type /bin/bash; I assume I am in bash now, but if I echo $SHELL I still get /bin/zsh
What's wrong, please?
bash shell zsh
I am trying to jump between zsh and bash.
By default, I have zsh as my shell, I can know this by typing:
echo $SHELL and I get /bin/zsh
However, I want to open Bash, so I type /bin/bash; I assume I am in bash now, but if I echo $SHELL I still get /bin/zsh
What's wrong, please?
bash shell zsh
bash shell zsh
edited yesterday
Jeff Schaller♦
46.4k1166151
46.4k1166151
asked Jun 4 at 20:16
Jack ThomsonJack Thomson
695
695
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
Jun 4 at 20:34
add a comment |
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
Jun 4 at 20:34
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
Jun 4 at 20:34
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
Jun 4 at 20:34
add a comment |
2 Answers
2
active
oldest
votes
SHELL is an environment variable that is passed from bash to zsh when you call zsh. SHELL is not one of the Parameters Set By The Shell in zsh, so its value remains intact.
bash$ SHELL=turtle zsh
zsh$ echo $SHELL
turtle
For indications that you're in a zsh shell, try:
echo $ZSH_NAME
echo $0
The SHELL variable is traditionally set by the login program, "as specified by the password database". (Copied from What sets the $SHELL environment variable?)
I'd welcome better indications of a zsh shell; a possible list includes $module_path and $ZSH_VERSION, although in theory other shells could set those.
– Jeff Schaller♦
Jun 4 at 20:31
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
Jun 4 at 20:33
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
Jun 4 at 21:29
Great point, @Jack. See the update; your passwd entry likely still points to /bin/bash; you may try (or request the change) to set it to zsh.
– Jeff Schaller♦
Jun 4 at 22:36
add a comment |
Many shells set a version variable on starting.
bash use BASH_VERSION and zsh use ZSH_VERSION.
Setting both variables to a known value will reliably detect which shell was started:
BASH_VERSION=notbash ZSH_VERSION=notzsh sh -c 'echo "$BASH_VERSION $ZSH_VERSION"'
will print notbash 5.3.1 if sh is zsh or 5.0.2(2)-release notzsh if sh is bash.
Sadly ksh segfaults on using KSH_VERSION with a string value.
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
Jun 4 at 21:32
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShelland by several other methods. @JackThomson
– Isaac
Jun 4 at 21:34
fair point, indeed
– Jack Thomson
Jun 4 at 21:38
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522907%2fshell-environment-variable-still-points-to-zsh-after-using-bash%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
SHELL is an environment variable that is passed from bash to zsh when you call zsh. SHELL is not one of the Parameters Set By The Shell in zsh, so its value remains intact.
bash$ SHELL=turtle zsh
zsh$ echo $SHELL
turtle
For indications that you're in a zsh shell, try:
echo $ZSH_NAME
echo $0
The SHELL variable is traditionally set by the login program, "as specified by the password database". (Copied from What sets the $SHELL environment variable?)
I'd welcome better indications of a zsh shell; a possible list includes $module_path and $ZSH_VERSION, although in theory other shells could set those.
– Jeff Schaller♦
Jun 4 at 20:31
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
Jun 4 at 20:33
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
Jun 4 at 21:29
Great point, @Jack. See the update; your passwd entry likely still points to /bin/bash; you may try (or request the change) to set it to zsh.
– Jeff Schaller♦
Jun 4 at 22:36
add a comment |
SHELL is an environment variable that is passed from bash to zsh when you call zsh. SHELL is not one of the Parameters Set By The Shell in zsh, so its value remains intact.
bash$ SHELL=turtle zsh
zsh$ echo $SHELL
turtle
For indications that you're in a zsh shell, try:
echo $ZSH_NAME
echo $0
The SHELL variable is traditionally set by the login program, "as specified by the password database". (Copied from What sets the $SHELL environment variable?)
I'd welcome better indications of a zsh shell; a possible list includes $module_path and $ZSH_VERSION, although in theory other shells could set those.
– Jeff Schaller♦
Jun 4 at 20:31
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
Jun 4 at 20:33
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
Jun 4 at 21:29
Great point, @Jack. See the update; your passwd entry likely still points to /bin/bash; you may try (or request the change) to set it to zsh.
– Jeff Schaller♦
Jun 4 at 22:36
add a comment |
SHELL is an environment variable that is passed from bash to zsh when you call zsh. SHELL is not one of the Parameters Set By The Shell in zsh, so its value remains intact.
bash$ SHELL=turtle zsh
zsh$ echo $SHELL
turtle
For indications that you're in a zsh shell, try:
echo $ZSH_NAME
echo $0
The SHELL variable is traditionally set by the login program, "as specified by the password database". (Copied from What sets the $SHELL environment variable?)
SHELL is an environment variable that is passed from bash to zsh when you call zsh. SHELL is not one of the Parameters Set By The Shell in zsh, so its value remains intact.
bash$ SHELL=turtle zsh
zsh$ echo $SHELL
turtle
For indications that you're in a zsh shell, try:
echo $ZSH_NAME
echo $0
The SHELL variable is traditionally set by the login program, "as specified by the password database". (Copied from What sets the $SHELL environment variable?)
edited Jun 4 at 22:35
answered Jun 4 at 20:26
Jeff Schaller♦Jeff Schaller
46.4k1166151
46.4k1166151
I'd welcome better indications of a zsh shell; a possible list includes $module_path and $ZSH_VERSION, although in theory other shells could set those.
– Jeff Schaller♦
Jun 4 at 20:31
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
Jun 4 at 20:33
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
Jun 4 at 21:29
Great point, @Jack. See the update; your passwd entry likely still points to /bin/bash; you may try (or request the change) to set it to zsh.
– Jeff Schaller♦
Jun 4 at 22:36
add a comment |
I'd welcome better indications of a zsh shell; a possible list includes $module_path and $ZSH_VERSION, although in theory other shells could set those.
– Jeff Schaller♦
Jun 4 at 20:31
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
Jun 4 at 20:33
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
Jun 4 at 21:29
Great point, @Jack. See the update; your passwd entry likely still points to /bin/bash; you may try (or request the change) to set it to zsh.
– Jeff Schaller♦
Jun 4 at 22:36
I'd welcome better indications of a zsh shell; a possible list includes $module_path and $ZSH_VERSION, although in theory other shells could set those.
– Jeff Schaller♦
Jun 4 at 20:31
I'd welcome better indications of a zsh shell; a possible list includes $module_path and $ZSH_VERSION, although in theory other shells could set those.
– Jeff Schaller♦
Jun 4 at 20:31
1
1
Also for consideration:
ps -ocomm= -p $$– Jeff Schaller♦
Jun 4 at 20:33
Also for consideration:
ps -ocomm= -p $$– Jeff Schaller♦
Jun 4 at 20:33
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
Jun 4 at 21:29
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
Jun 4 at 21:29
Great point, @Jack. See the update; your passwd entry likely still points to /bin/bash; you may try (or request the change) to set it to zsh.
– Jeff Schaller♦
Jun 4 at 22:36
Great point, @Jack. See the update; your passwd entry likely still points to /bin/bash; you may try (or request the change) to set it to zsh.
– Jeff Schaller♦
Jun 4 at 22:36
add a comment |
Many shells set a version variable on starting.
bash use BASH_VERSION and zsh use ZSH_VERSION.
Setting both variables to a known value will reliably detect which shell was started:
BASH_VERSION=notbash ZSH_VERSION=notzsh sh -c 'echo "$BASH_VERSION $ZSH_VERSION"'
will print notbash 5.3.1 if sh is zsh or 5.0.2(2)-release notzsh if sh is bash.
Sadly ksh segfaults on using KSH_VERSION with a string value.
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
Jun 4 at 21:32
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShelland by several other methods. @JackThomson
– Isaac
Jun 4 at 21:34
fair point, indeed
– Jack Thomson
Jun 4 at 21:38
add a comment |
Many shells set a version variable on starting.
bash use BASH_VERSION and zsh use ZSH_VERSION.
Setting both variables to a known value will reliably detect which shell was started:
BASH_VERSION=notbash ZSH_VERSION=notzsh sh -c 'echo "$BASH_VERSION $ZSH_VERSION"'
will print notbash 5.3.1 if sh is zsh or 5.0.2(2)-release notzsh if sh is bash.
Sadly ksh segfaults on using KSH_VERSION with a string value.
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
Jun 4 at 21:32
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShelland by several other methods. @JackThomson
– Isaac
Jun 4 at 21:34
fair point, indeed
– Jack Thomson
Jun 4 at 21:38
add a comment |
Many shells set a version variable on starting.
bash use BASH_VERSION and zsh use ZSH_VERSION.
Setting both variables to a known value will reliably detect which shell was started:
BASH_VERSION=notbash ZSH_VERSION=notzsh sh -c 'echo "$BASH_VERSION $ZSH_VERSION"'
will print notbash 5.3.1 if sh is zsh or 5.0.2(2)-release notzsh if sh is bash.
Sadly ksh segfaults on using KSH_VERSION with a string value.
Many shells set a version variable on starting.
bash use BASH_VERSION and zsh use ZSH_VERSION.
Setting both variables to a known value will reliably detect which shell was started:
BASH_VERSION=notbash ZSH_VERSION=notzsh sh -c 'echo "$BASH_VERSION $ZSH_VERSION"'
will print notbash 5.3.1 if sh is zsh or 5.0.2(2)-release notzsh if sh is bash.
Sadly ksh segfaults on using KSH_VERSION with a string value.
answered Jun 4 at 21:29
IsaacIsaac
13.1k12159
13.1k12159
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
Jun 4 at 21:32
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShelland by several other methods. @JackThomson
– Isaac
Jun 4 at 21:34
fair point, indeed
– Jack Thomson
Jun 4 at 21:38
add a comment |
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
Jun 4 at 21:32
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShelland by several other methods. @JackThomson
– Isaac
Jun 4 at 21:34
fair point, indeed
– Jack Thomson
Jun 4 at 21:38
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
Jun 4 at 21:32
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
Jun 4 at 21:32
1
1
The value of $0 could be modified at will, for example:
sh -c 'echo "$0"' MyNameOfShell and by several other methods. @JackThomson– Isaac
Jun 4 at 21:34
The value of $0 could be modified at will, for example:
sh -c 'echo "$0"' MyNameOfShell and by several other methods. @JackThomson– Isaac
Jun 4 at 21:34
fair point, indeed
– Jack Thomson
Jun 4 at 21:38
fair point, indeed
– Jack Thomson
Jun 4 at 21:38
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522907%2fshell-environment-variable-still-points-to-zsh-after-using-bash%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
Jun 4 at 20:34