# Shell ###### tags: `計算機概論` ## :apple: 概述 ![user & shell & kernel & hardware](https://hackmd.io/_uploads/r1EV7ra_p.png) 為 Command Interpreter(命令解譯器),使用者操作 shell 的其中一種語言(e.g. zsh, bash, sh, etc.),來和 kernel(核心) 溝通,kernel(核心)在去驅動 hardware(硬體設備) ## :apple: 語言種類 ### ==sh== - 全名 [Bourne shell](https://zh.wikipedia.org/wiki/Bourne_shell),Unix 系統中最早的 Command Interpreter,現今 Unix 系統中的 sh 實際上是指向更現代的版本 e.g. Bash ### bsh - 全名 [Bean Shell](https://en.wikipedia.org/wiki/BeanShell),具有物件腳本語言功能,於 `Java 執行環境 (JRE)` 中運行,動態執行標準 Java 語法 ### ash - 全名 [Almquist shell](https://zh.wikipedia.org/wiki/Almquist_shell),簡單的輕量級 shell,特色是快而且輕巧 ### ==bash== - 全名 [Bourne-Again shell](https://en.wikipedia.org/wiki/Bash_(Unix_shell)),是 Bourne shell(sh) 的後繼相容版本與開放原始碼版本 ### csh - 全名 [C shell](https://zh.wikipedia.org/wiki/C_Shell),語法類似於C語言 ### tcsh - 全名 [Tenex C shell](https://zh.wikipedia.org/wiki/Tcsh),csh 的後繼增強版 ### ==zsh== - 全名 [Z shell](https://zh.wikipedia.org/wiki/Z_shell),zsh 對 Bourne shell 做出了大量改進,同時加入了 bash, csh, dash, kshsh, tcsh 的某些功能 - 自 2019 年起,macOS 的預設 Shell 已從 Bash 改為 zsh - 多種相容模式(e.g. zsh 可在執行為 `/bin/sh` 的情況下偽裝成 Bourne shell) ## :apple: 檢視系統設置 - 查詢系統默認 shell 語言 ```bash= $ echo $SHELL ``` - 系統安裝的所有 shell 語言 ```bash= cat /etc/shells ``` ## :apple: 語法 :::success 翻譯 shell 工具: [explainshell.com](https://explainshell.com/) ::: > 參考: > > [Wikipedia - shell](https://zh.wikipedia.org/zh-tw/%E6%AE%BC%E5%B1%A4) > > [shell有哪些? Zsh和Bash的差別是什麼?](https://www.jianshu.com/p/a891af6f87e0)