Linux Bash shell is the most popular shell. /bin/bash
is the path and executable of the Bash shell. /bin/bash is a binary that is used in different ways to run and execute commands and scripts.
Linux Bash外壳是最受欢迎的外壳。 /bin/bash
是Bash shell的路径和可执行文件。 / bin / bash是一种二进制文件,以不同的方式用于运行和执行命令和脚本。
脚本文件解释器#!/ bin / bash (Script File Interpreter #!/bin/bash)
In Linux and opensource world script files are very important. There are different types of scripting languages used to write script files. As file extension is just a label for a script file interpreter line is used to specify the scripting language. #!/bin/bash
specifies that current file is a bash script which will be interpreted with the bash or interpreter /bin/bash
在Linux和开源世界中,脚本文件非常重要。 有多种类型的脚本语言可用于编写脚本文件。 由于文件扩展名只是脚本文件的标签,解释器行用于指定脚本语言。 #!/bin/bash
指定当前文件是bash脚本,将使用bash或解释器/bin/bash
解释
#!/bin/bash
#
and !
makes this line special because #
is used as comment line in bash. !
is called
#
和!
使此行特别,因为#
用作bash中的注释行。 !
叫做
替代壳(Alternative Shells)
Bash is very popular shell but there are a lot of alternatives to the Bash. Here is some of them.
Bash是非常流行的shell,但是Bash有很多替代方案。 这是其中的一些。
- SH is a very basic shell that provides fundamental features of the Bash. SH是提供Bash基本功能的非常基本的外壳。
- KSH is Korn shell which is similar to the Bash. KSH是类似于Bash的Korn外壳。
- CSH is mainly designed from C programming language. CSH主要是用C编程语言设计的。
#!/ bin / sh和#!/ bin / bash之间的区别 (Difference Between #!/bin/sh and #!/bin/bash)
As stated previously bash binary is stored in the /bin/bash
path in general. /bin/sh
provides the SH shell which is downgraded with less functional version of the BASH.
如前所述,bash二进制文件通常存储在/bin/bash
路径中。 /bin/sh
提供了SH shell,并通过BASH的较低功能版本对其进行了降级。
Bash Shell命令 (Bash Shell Commands)
Detailed information can be listed with the man
command like below. This provides detailed information about the BASH
shell and related commands.
可以使用如下所示的man
命令列出详细信息。 这提供了有关BASH
Shell和相关命令的详细信息。
$ man bash
OR
要么
$ man /bin/bash

翻译自: https://www.poftut.com/linux-bin-bash-shell-and-script-tutorial/