Bash is very popular Linux and Unix shell used system administrators. Even most of the users do not know that they are using bash shell because of it is provided by default in the operating system. There are different shell types supported by Linux, Unix and BSD. Korn shell is another but less popular shell. In this post we will compare bash
and ksh
and try to show differences and similarities between them.
Bash是非常流行Linux和Unix Shell使用的系统管理员。 甚至大多数用户都不知道他们在使用bash shell,因为操作系统默认情况下提供了它。 Linux,Unix和BSD支持不同的外壳类型。 Korn外壳是另一个但不太流行的外壳。 在这篇文章中,我们将比较bash
和ksh
并尝试显示它们之间的差异和相似之处。
Bash和Korn Shell Binaries (Bash and Korn Shell Binaries)
Bash shell binary or interpreter is located at the /bin/bash
. While bash interpreter binary size is 1.1 MB
Bash shell二进制或解释器位于/bin/bash
。 虽然bash解释器的二进制大小为1.1 MB
Ksh shell binary or interpreter is located as /bin/ksh
. Korn shell binary is 1.6 MB.
Ksh Shell二进制或解释器位于/bin/ksh
。 Korn Shell二进制文件为1.6 MB。

脚本扩展(Script Extension)
As issuing same commands again and again not a practical way we generally prefer scripts. Both bash and ksh have scripting capabilities. While extension is not a must we can use them to identify easily.
由于一次又一次地发出相同的命令不是一种实用的方法,因此我们通常更喜欢脚本。 bash和ksh都具有脚本功能。 虽然扩展不是必须的,但我们可以使用它们轻松识别。
Bash have script extension .sh
Bash具有脚本扩展名.sh
Korn shell have script extension .ksh
Korn Shell具有脚本扩展名.ksh
编程功能 (Programming Features)
Both of the shells provides programming features. Their syntax is similar to each other. Korn shell provides more features than bash because it is designed to be superior than programming rich shells like C Shell, TC shell, Bourne shell.
这两个外壳程序均提供编程功能。 它们的语法彼此相似。 Korn Shell提供了比bash更多的功能,因为它的设计要优于对丰富的Shell(例如C Shell,TC Shell,Bourne Shell)进行编程。
性能 (Performance)
Bash have decent performance while running commands in the interactive shell or as a script.
在交互式shell中或作为脚本运行命令时,Bash具有不错的性能。
Korn shell provides a little bit more performance for command execution and scripts.
Korn Shell为命令执行和脚本提供了更多性能。
特征 (Features)
As we can see from first part the size of the ksh binary is bigger than bash.
从第一部分可以看出,ksh二进制文件的大小大于bash。
Bash provides rich feature set.
Bash提供了丰富的功能集。
Korn shell provides rich feature set which exceeds the bash features but this may require more time to learn. Korn shell have print
command which behaves better than bash echo
.
Korn Shell提供了丰富的功能集,超过了bash功能,但这可能需要更多的时间来学习。 Korn shell具有print
命令,其行为优于bash echo
。