LoginSignup
0
2

More than 3 years have passed since last update.

現在利用しているシェルの種類を確認する(GNU BashなのかZ Shellなのか)

Last updated at Posted at 2020-11-27

実現したいこと

ターミナルで現在利用しているがbash(GNU Bash)なのかzsh(Z-shell)を表示する
※macOS Catalinaから標準シェルがzshになっている。

実行コマンド

CentOS Linux release 7.9.2009 の場合

$ uname
Linux 
$ ps -p $$ | tail -1 | awk '{print $NF}'
bash
$

macOS Catalina の場合

% uname
Darwin
% ps -p $$ | tail -1 | awk '{print $NF}'
-zsh
% 

補足

echo $SHELL
  • 上記の方法は、あまり良い方法ではない。
$ echo $SHELL
/bin/bash
$ SHELL="hoge"
$ echo $SHELL
hoge
% echo $SHELL
/bin/zsh
% SHELL="hoge"
% echo $SHELL
hoge
% 

情報源

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2