为什么 Bourne shell 被认为是过时的?

为什么 Bourne shell 被认为是过时的?

Bourne shell 和 Bash 之间的关系是否类似于 C 和 C++ 的关系(如果是这样,则表明两者都作为 shell 占有一席之地)?每当我读到有关 shell 的内容时,它总是说 Bourne shell 已死且过时,但为什么呢?

答案1

您不太可能真正使用 Bourne Shell,而更有可能使用 dash(Debian Almquist Shell)。您可能想通过致电来检查这一点:

echo $0

shell 的确切名称可以通过whatshell脚本 检索https://www.in-ulm.de/~mascheck/various/whatshell/

但 dash 不是 Bourne Shell,并且就 UNIX 而言,比 Bourne Shell 更糟糕,因为 dash 不支持多字节字符

Bourne Shell 是一个由重写的 Thompson Shell 启动的 shell斯蒂芬·伯恩于 1976 年成立,自那时起便发生了巨大的变化。

1983 年,Bourne Shell 的副本被用作 Korn Shell (ksh) 的启动程序大卫·科恩

1988 年,Bourne Shell 和 ksh 确实获得了国际化支持,UNIX 中的 libc 一直发展到 1992 年,因此从那时起两者都支持多字节字符。

1989 年,Korn Shell 被用作 GNU 项目的 shell Bash 的典范。

1989 年,1982 年的 Bourne Shell 被用作 ash(Almquist shell)的典范,而 dash 是 ash 的错误修复版本。但 ash 和 dash 后来都添加了 POSIX 功能。

1992 年,POSIX 使用 ksh88 作为 POSIX shell 定义的典范。

2005 年,OpenSolaris 将 Bourne Shell 开源,从 2006 年开始,Bourne Shell 源代码不断发展,兼容 POSIX。

虽然 dash 缺少历史编辑器和多字节支持,但当前的 Bourne Shell 实现了这些功能。

然而,当今 shell 之间的主要区别在于(除了 POSIX 合规性之外)使 shell 非常适合用作交互式 shell 的功能。这是您从最近的 Bourne Shell (bosh)、ksh 和 Bash 中获得的结果,但不是从 dash 中获得的结果。

相关内容