Shell( 本身就是个程序 ) 的作用是解释执行用户的命令,用户输入一条命令, Shell 就解释执行一条,这种方式称为交互式 ( Interactive ), Shell 还有一种执行命令的方式称为批处理 ( Batch ),用户事先写一个 Shell 脚本( Script ),其中有很多条命令,让 Shell 一次把这些命令执行完,而不必一条一条地敲命令。
由于历史原因, UNIX 系统上有很多种 Shell :
1. sh ( Bourne Shell ):由 Steve Bourne 开发,各种 UNIX 系统都配有 。
2. csh ( C Shell ):由 Bill Joy( 软件爱迪生 ) 开发,随 BSD UNIX 发布,它的流程控制语句很像 C 语言,支持很多 Bourne Shell 所不支持的功能:作业控制,命令历史,命令行编辑。
3. ksh ( Korn Shell ):由 David Korn 开发,向后兼容 sh 的功能,并且添加了 引入的新功能,是目前很多 UNIX 系统标准配置的 Shell ,在这些系统上 往往是指向 的符号链接。
4. tcsh ( TENEX C Shell ):是 的增强版本,引入了命令补全等功能,在 FreeBSD 、 Mac OS X 等系统上替代了 csh 。
5. bash ( Bourne Again Shell ):由 GNU 开发的 Shell ,主要目标是与 POSIX 标准保持一致,同时兼顾对 的兼容, 从 和 借鉴了很多功能,是各种 Linux 发行版标准配置的 Shell ,在 Linux 系统上 往往是指向 的符号链接
文件 etc/shells 给出了系统中所有已知(不一定已安装)的 Shell ,除了上面提到的 Shell 之外还有很多变种。
leon@leon- desktop: ~ $ cat / etc/ shells # / etc/ shells: valid login shells / bin/ csh / bin/ sh / usr/ bin/ es / usr/ bin/ ksh / bin/ ksh / usr/ bin/ rc / usr/ bin/ tcsh / bin/ tcsh / usr/ bin/ esh / bin/ dash / bin/ bash / bin/ rbash / usr/ bin/ screen
用户的默认 Shell 设置在 /etc/passwd 文件中,
leon: x: 1000: 1000: leon, , , : / home/ leon: / bin/ bash
用户leon从字符终端登录或者从图形终端登录,就会执行/bin/bash,如果要切换到其它 Shell ,可以在命令行输入程序名,例如:sh。
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(1081) | 评论(0) | 转发(0) |