什么是 Bash?
一、介绍
在 Linux 系统中,Bash(Bourne Again SHell)是一种命令行解释器和脚本语言,也是许多 Unix 和 Linux 系统的默认 Shell。Bash 是从 Bourne Shell(sh)发展而来的一种强化版本,提供了更多功能和改进。
Bash 提供了一个交互式的命令行界面,使用户能够通过键入命令来与操作系统进行交互。此外,Bash 还支持脚本编程,用户可以编写和执行批处理脚本,以自动化和简化各种系统管理任务。
一些 Bash 的特性包括:
- 命令历史: 记录用户执行的命令,方便用户查看和重新执行历史命令。
- 自动补全: 提供命令和文件名的自动补全,以加快命令输入的速度。
- 作业控制: 允许在后台运行和控制作业,以及在前台或后台挂起和恢复作业。
- 别名: 允许用户定义和使用简化的命令别名。
- 条件测试和流程控制: 提供条件语句和循环结构,支持脚本中的逻辑判断和控制流程。
- 环境变量: 支持设置和使用环境变量,用于配置用户和系统的行为。
Bash 在 Linux 和其他类 Unix 系统中广泛使用,它是一个强大而灵活的 Shell,适用于各种系统管理和脚本编程任务。用户可以通过修改配置文件(如 .bashrc
和 .bash_profile
)来个性化和定制 Bash 的行为。
二、GNU 官方解释
可以在 GUN 的官网查看所有的 GNU 软件,其中可以找到 Bash 的各种类型的文档介绍
1、简介
Bash is the GNU Project’s shell—the Bourne Again SHell. This is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and the C shell (csh). It is intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers functional improvements over sh for both programming and interactive use. In addition, most sh scripts can be run by Bash without modification.
The improvements offered by Bash include:
- 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.
The maintainer also has a Bash page which includes Frequently Asked Questions.
Bash 是 GNU 项目的 shell,全名 Bourne Again SHell。这是一个与 sh 兼容的 shell,它集成了来自 Korn shell(ksh)和 C shell(csh)的有用功能。它旨在符合 IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools 标准。它在编程和交互使用方面相对于 sh 提供了功能上的改进。此外,大多数 sh 脚本可以在不经修改的情况下由 Bash 运行。
Bash 提供的改进包括:
- 命令行编辑
- 无限大小的命令历史记录
- 作业控制
- shell 函数和别名
- 无限大小的索引数组
- 从二到六十四的任何基数中的整数算术
2、文档内详细解释
Bash is the shell, or command language interpreter, for the GNU operating system. The name is an acronym for the ‘Bourne-Again SHell’, a pun on Stephen Bourne, the author of the direct ancestor of the current Unix shell
sh
, which appeared in the Seventh Edition Bell Labs Research version of Unix.Bash is largely compatible with
sh
and incorporates useful features from the Korn shellksh
and the C shellcsh
. It is intended to be a conformant implementation of the IEEE POSIX Shell and Tools portion of the IEEE POSIX specification (IEEE Standard 1003.1). It offers functional improvements oversh
for both interactive and programming use.While the GNU operating system provides other shells, including a version of
csh
, Bash is the default shell. Like other GNU software, Bash is quite portable. It currently runs on nearly every version of Unix and a few other operating systems - independently-supported ports exist for MS-DOS, OS/2, and Windows platforms.
相关链接
Bash - GNU Project - Free Software Foundation
The GNU Bourne-Again Shell (case.edu)
Bash Reference Manual (gnu.org)
OB links
OB tags
#Linux #Shell