Abh*_*ngh 3 bash dash-shell sh
Ubuntu中不同shell有什么区别:
$ cat /etc/shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
Run Code Online (Sandbox Code Playgroud)
重击
Bash 是 GNU 项目的外壳。Bash 是 Bourne Again Shell。Bash 是一个与 sh 兼容的 shell,它结合了 Korn shell (ksh) 和 C shell (csh) 的有用功能。它旨在符合 IEEE POSIX P1003.2/ISO 9945.2 外壳和工具标准。它为编程和交互使用提供了对 sh 的功能改进。此外,大多数 sh 脚本无需修改即可由 Bash 运行。
Bash 提供的改进包括:
Run Code Online (Sandbox Code Playgroud)Command line editing Unlimited size command history Job Control Shell Functions and Aliases Indexed arrays of unlimited size Integer arithmetic in any base from two to sixty-four.
资料来源:1
短跑
Dash 是 Debian Almquist shell (dash) 的首字母缩写。它是一个 Unix 和 Linux shell,比 bash 小得多,但仍以符合 POSIX 为目标。dash 是 /bin/sh 的 POSIX 兼容实现,旨在尽可能小。dash 是 ash 的 NetBSD 版本(Almquist SHell)的直接后代,于 1997 年初移植到 Linux。它在 2002 年更名为 dash。
dash 是 Linux 系统的标准命令解释器。当前版本的 dash 正在更改以符合 shell 的 POSIX 1003.2 和 1003.2a 规范。此版本具有许多功能,使其在某些方面与 Korn shell 相似,但它不是 Korn shell 克隆。只有 POSIX 指定的功能以及一些 Berkeley 扩展被合并到这个 shell 中。
资料来源:2
RBash
如果 Bash 以名称 rbash 启动,或者在调用时提供了 --restricted 或 -r 选项,则 shell 将受到限制。受限 shell 用于设置比标准 shell 更受控制的环境。受限 shell 的行为与 bash 相同,除了以下内容被禁止或不执行:
Run Code Online (Sandbox Code Playgroud)Changing directories with the cd builtin. Setting or unsetting the values of the SHELL, PATH, ENV, or BASH_ENV variables. Specifying command names containing slashes. Specifying a filename containing a slash as an argument to the . builtin command. Specifying a filename containing a slash as an argument to the -p option to the hash builtin command. Importing function definitions from the shell environment at startup. Parsing the value of SHELLOPTS from the shell environment at startup. Redirecting output using the ‘>’, ‘>|’, ‘<>’, ‘>&’, ‘&>’, and ‘>>’ redirection operators. Using the exec builtin to replace the shell with another command. Adding or deleting builtin commands with the -f and -d options to the enable builtin. Using the enable builtin command to enable disabled shell builtins. Specifying the -p option to the command builtin. Turning off restricted mode with ‘set +r’ or ‘set +o restricted’.在读取任何启动文件后会强制执行这些限制。
当执行发现是 shell 脚本的命令时(请参阅 Shell 脚本),rbash 会关闭为执行该脚本而生成的 shell 中的任何限制。
资料来源:3
嘘
sh 是 Bourne shell 的命令名称,它是 Unix 和许多类 Unix 操作系统(包括 Linux)的标准命令语言解释器。sh 是一种命令语言解释器,它执行从命令行字符串、标准输入或指定文件中读取的命令。
Bourne shell 于 1977 年由 AT&T 贝尔实验室的 Stephen Bourne 于 1977 年开发。它是 Unix 版本 7 的默认 shell。大多数类 Unix 系统都包含文件 /bin/sh,它是 Bourne shell 或符号链接(或硬链接)到兼容的外壳。
来源:4