Linux / bin / bash Shell和脚本教程

本文详细介绍了Linux中最受欢迎的Bash外壳,探讨了/bin/bash路径、不同脚本语言及#!/bin/bash的作用。此外,还涵盖了替代shell选项如SH、KSH和CSH,以及#!/bin/sh与#!/bin/bash的区别。此外,Bash命令及其帮助文档的获取方法也被逐一讲解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
BASH Help
BASH Help
BASH帮助
LEARN MORE  Get-Service Service Management With Windows Powershell From Command Line
通过命令行了解更多有关Windows Powershell的Get-Service服务管理的信息

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值