bash 我在 mac 中使用的是哪个 shell
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43417162/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which shell I am using in mac
提问by shantanu
Default shell in my mac was bash.
I have tried to change it into ZSH by command chsh -s /bin/zsh
.
我的 mac 中的默认 shell 是 bash。
我试图通过命令将其更改为 ZSH chsh -s /bin/zsh
。
Now when I am trying to check the shell type, I am getting different responses.
现在,当我尝试检查外壳类型时,我得到了不同的响应。
COMMAND-1
命令 1
input : echo $SHELL
output : /bin/zsh
输入:echo $SHELL
输出:/bin/zsh
COMMAND-2
命令 2
input : ps $o
output : 7655 ttys002 0:00.03 -bash
输入:ps $o
输出:7655 ttys002 0:00.03 -bash
COMMAND-3
命令 3
input : ps -p $$ | awk '$1 == PP {print $4}' PP=$$
output : -bash
输入:ps -p $$ | awk '$1 == PP {print $4}' PP=$$
输出:-bash
I am not sure which shell I am using. Do I need to do something additional to change my shell into ZSH.
我不确定我使用的是哪个 shell。我是否需要做一些额外的事情来将我的 shell 更改为ZSH。
采纳答案by NobodyNada - Reinstate Monica
macOS's Terminal allows you to specify the shell in its preferences. By default, it is set to use your login shell, but it looks like you've overridden it to use Bash.
macOS 的终端允许您在其首选项中指定 shell。默认情况下,它设置为使用您的登录 shell,但您似乎已将其覆盖为使用 Bash。
In the General tab of Terminal's preferences, set it to "Default login shell," to prevent your login shell from being overridden:
在终端首选项的常规选项卡中,将其设置为“默认登录外壳”,以防止您的登录外壳被覆盖:
Also, make sure the "Run command" checkbox is not checked in the Shell tab of your profiles' settings:
另外,请确保在配置文件设置的 Shell 选项卡中未选中“运行命令”复选框:
回答by mklement0
Assuming you're using the standard Terminal.app
and you've verified that it is indeed configured to use your default login shell, as described in NobodyNada's helpful answer:
假设您使用的是标准Terminal.app
并且您已经验证它确实被配置为使用您的默认登录 shell,如NobodyNada 的有用答案中所述:
To see what shell is currently running(which may or may not be your default shell), use:
要查看当前正在运行的shell (可能是也可能不是您的默认 shell),请使用:
ps -o comm= $$
To see what shell is your defaultshell, run:
要查看默认shell是哪个shell,请运行:
echo "$SHELL"