1、檢查當前shell
myMacBook-Pro:/ zzz$ echo $SHELL /bin/bash
其實終端窗口的標題欄上顯示着當前shell的名字呢。
2、檢查系統支持的所有shell
myMacBook-Pro:/ zzz$ cat /etc/shells # List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells. /bin/bash /bin/csh /bin/dash /bin/ksh /bin/sh /bin/tcsh /bin/zsh
3、切換到某個shell,如zsh
myMacBook-Pro:~ zzz$ chsh -s /bin/zsh Changing shell for zzz Password for zzz: ***
為了驗證是否成功,需要退出當前終端,重新開啟終端窗口,可以檢查$SHELL的值已經改變
myMacBook-Pro:/ zzz$ echo $SHELL /bin/zsh
EOF