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 BashGlobbing fails in zsh, but works in bashCan't open shell after changing default shellConfigure 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 variableVariable fg_bold seems not to be defined in a zsh script, how come? (oh-my-sh)Konsole does not run shell specified in /etc/passwd
How is water heavier than petrol, even though its molecular weight is less than petrol?
How do governments keep track of their issued currency?
Is it a problem if <h4>, <h5> and <h6> are smaller than regular text?
SHELL environment variable still points to zsh after using bash
What is the actual quality of machine translations?
Pre-1972 sci-fi short story or novel: alien(?) tunnel where people try new moves and get destroyed if they're not the correct ones
Is a lack of character descriptions a problem?
Generate a Graeco-Latin square
Fixing obscure 8080 emulator bug?
Why is one of Madera Municipal's runways labelled with only "R" on both sides?
Can U.S. Tax Forms Be Legally HTMLified?
bash script: "*.jpg" expansion not working as expected inside $(...), for picking a random file
How to deal with apathetic co-worker?
Why did the Herschel Space Telescope need helium coolant?
Does Disney no longer produce hand-drawn cartoon films?
English word for "product of tinkering"
Someone whose aspirations exceed abilities or means
How can electric fields be used to detect cracks in metals?
Are there any important biographies of nobodies?
What ways have you found to get edits from non-LaTeX users?
SQL counting distinct over partition
Should I give professor gift at the beginning of my PhD?
Is counterpoint still used today?
Cycle through MeshStyle directives in ListLinePlot
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 BashGlobbing fails in zsh, but works in bashCan't open shell after changing default shellConfigure 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 variableVariable fg_bold seems not to be defined in a zsh script, how come? (oh-my-sh)Konsole does not run shell specified in /etc/passwd
.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 wanna open Bash, so I type /bin/bash
, so 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 wanna open Bash, so I type /bin/bash
, so 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♦
8 hours ago
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 wanna open Bash, so I type /bin/bash
, so 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 wanna open Bash, so I type /bin/bash
, so 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
asked 8 hours ago
Jack ThomsonJack Thomson
535
535
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
8 hours ago
add a comment |
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
8 hours ago
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
8 hours ago
Linking in for similarity: unix.stackexchange.com/q/71121/117549
– Jeff Schaller♦
8 hours ago
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♦
8 hours ago
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
8 hours ago
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
7 hours ago
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♦
6 hours ago
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
7 hours ago
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShell
and by several other methods. @JackThomson
– Isaac
7 hours ago
fair point, indeed
– Jack Thomson
7 hours ago
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♦
8 hours ago
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
8 hours ago
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
7 hours ago
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♦
6 hours ago
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♦
8 hours ago
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
8 hours ago
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
7 hours ago
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♦
6 hours ago
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 6 hours ago
answered 8 hours ago
Jeff Schaller♦Jeff Schaller
46.4k1166150
46.4k1166150
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♦
8 hours ago
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
8 hours ago
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
7 hours ago
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♦
6 hours ago
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♦
8 hours ago
1
Also for consideration:ps -ocomm= -p $$
– Jeff Schaller♦
8 hours ago
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
7 hours ago
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♦
6 hours ago
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♦
8 hours ago
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♦
8 hours ago
1
1
Also for consideration:
ps -ocomm= -p $$
– Jeff Schaller♦
8 hours ago
Also for consideration:
ps -ocomm= -p $$
– Jeff Schaller♦
8 hours ago
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
7 hours ago
thank you, but how did $SHELL get assigned in the first place? I install zsh just recently
– Jack Thomson
7 hours ago
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♦
6 hours ago
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♦
6 hours ago
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
7 hours ago
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShell
and by several other methods. @JackThomson
– Isaac
7 hours ago
fair point, indeed
– Jack Thomson
7 hours ago
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
7 hours ago
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShell
and by several other methods. @JackThomson
– Isaac
7 hours ago
fair point, indeed
– Jack Thomson
7 hours ago
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 7 hours ago
IsaacIsaac
13k12158
13k12158
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
7 hours ago
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShell
and by several other methods. @JackThomson
– Isaac
7 hours ago
fair point, indeed
– Jack Thomson
7 hours ago
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
7 hours ago
1
The value of $0 could be modified at will, for example:sh -c 'echo "$0"' MyNameOfShell
and by several other methods. @JackThomson
– Isaac
7 hours ago
fair point, indeed
– Jack Thomson
7 hours ago
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
7 hours ago
maybe echo $0 is a bit easier than ZSH_VERSION, BASH_VERSION. but I like the idea, didn't about those variables
– Jack Thomson
7 hours ago
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
7 hours ago
The value of $0 could be modified at will, for example:
sh -c 'echo "$0"' MyNameOfShell
and by several other methods. @JackThomson– Isaac
7 hours ago
fair point, indeed
– Jack Thomson
7 hours ago
fair point, indeed
– Jack Thomson
7 hours ago
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♦
8 hours ago