bash 是一种编程语言吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28693737/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 21:52:47  来源:igfitidea点击:

Is bash a programming language?

bash

提问by boop

TL;DR;What are shell scripts? Is it a programming language / is there a programming language we use in shell scripts?

TL; 博士; 什么是 shell 脚本?它是一种编程语言/我们在 shell 脚本中使用了一种编程语言吗?



disclaimer: a bit offtopic
So bash stands for Bourne-again shell. A (Unix) Shell is a command line user interface or maybe one could call it an interpreter (?)

免责声明:有点离题
所以 bash 代表Bourne-again shell。(Unix)Shell 是一个命令行用户界面,或者可以将其称为解释器(?)

So I'm filling out an application for a new job and you get asked for experience of different programming languages and then there is this box at the bottom other experiences- I started typing python 2.7, powershell, bas...Wait! bash isn't a programming language - it's a console that can execute shell scripts... so... eh.... oh my god I have no idea!

所以我正在填写一份新工作的申请,你被要求提供不同编程语言的经验,然后在底部有其他经验的这个框- 我开始输入python 2.7、powershell、bas ......等等!bash 不是一种编程语言——它是一个可以执行 shell 脚本的控制台......所以......呃......哦,我的上帝,我不知道!

回答by fedorqui 'SO stop harming'

We can say that yes, it is a programming language.

我们可以说是的,它是一种编程语言。

According to man bash, Bash is a "sh-compatible command language". Then, we can say a "command language" is "a programming language through which a user communicates with the operating system or an application".

根据man bash,Bash 是一种“与 sh 兼容的命令语言”。那么,我们可以说“命令语言”是“用户与操作系统或应用程序进行通信的一种编程语言”。

From man bash:

来自man bash

DESCRIPTION

Bash is an sh-compatible command languageinterpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh and csh).

描述

Bash 是一种与 sh 兼容的命令语言解释器,它执行从标准输入或文件中读取的命令。Bash 还结合了来自 Korn 和 C shell(ksh 和 csh)的有用功能。

http://www.gnu.org/software/bash/

http://www.gnu.org/software/bash/

Bash is the GNU Project's shell. Bash is the Bourne Again SHell. Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and 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.

Bash 是 GNU 项目的外壳。Bash 是 Bourne Again Shell。Bash 是一个与 sh 兼容的 shell,它结合了 Korn shell (ksh) 和 C shell (csh) 的有用功能。它旨在符合 IEEE POSIX P1003.2/ISO 9945.2 外壳和工具标准。它为编程和交互使用提供了对 sh 的功能改进。此外,大多数 sh 脚本无需修改即可由 Bash 运行。

And a UNIX shell is... http://en.wikipedia.org/wiki/Unix_shell

一个 UNIX shell 是... http://en.wikipedia.org/wiki/Unix_shell

A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. Users direct the operation of the computer by entering commands as text for a command line interpreter to execute, or by creating text scripts of one or more such commands. Users typically interact with a Unix shell using a terminal emulator, however, direct operation via serial hardware connections, or networking session, are common for server systems.

Unix shell 是一个命令行解释器或 shell,它为 Unix 操作系统和类 Unix 系统提供传统的用户界面。用户通过输入命令作为命令行解释器执行的文本,或者通过创建一个或多个这样的命令的文本脚本来指导计算机的操作。用户通常使用终端仿真器与 Unix shell 交互,但是,通过串行硬件连接或网络会话的直接操作对于服务器系统来说很常见。

回答by Paul Evans

Bash most certainly isa programming language, one that specialises in the unix/linux shell scripting. It's turing complete so you could (theoretically) write any program in Bash.

Bash 无疑一种编程语言,专门用于 unix/linux shell 脚本。它是图灵完备的,因此您(理论上)可以在 Bash 中编写任何程序。