Is Bash an interpreted language?

From what I read so far, bash seems to fit the definition of the interpreted language:

However, I could not find the bash link on the Wikipedia page for interpreted languages or an extensive Google search. I also found a page on the Programmers Stack Exchange block, which apparently implies that bash is not interpreted as language-, if not, what is it?

+13
bash shell scripting-language interpreted-language compiled-language
source share
2 answers

Bash is definitely interpreted; I do not think you have a reasonable question.

There may be some disagreement over whether this is a language. It is intended primarily for interactive use by executing commands provided by the operating system. For a lot of this particular use, if you just type commands like

 echo hello 

or

 cp foo.txt bar.txt 

it’s easy to think that it is “just” for simple commands. In this sense, it is very different from interpreted languages ​​such as Perl and Python, which, although they can be used interactively, are mainly used to write scripts (interpreted programs).

One consequence of this emphasis is that its design is optimized for interactive use. Strings do not require quotes, most commands are executed immediately after they are entered, most of the things you do with it will call external programs, not built-in functions, etc.

But, as we know, it is also possible to write scripts using bash, and bash has many functions, in particular flow control constructs, which are mainly used in scripts (although they can also be used on the command line).

Another difference between bash and many scripting languages ​​is that the bash script is read, parsed, and executed in order. A syntax error in the middle of the bash script will not be detected until execution reaches it. A Perl or Python script, by contrast, is parsed completely prior to execution. (Things like eval can change this, but the general idea is true.) This is a significant difference, but it does not indicate a sharp dividing line. If something makes Perl and Python more like compiled languages.

Bottom line: Yes, bash is an interpreted language. Or, perhaps more accurately, bash is the interpreter for the interpreted language. (The name "bash" usually refers to a shell interpreter or interpreter, not what it interprets.) It has some significant differences from other interpreted languages ​​that were developed from the very beginning for scripting, but these differences are not enough to remove it from the category "interpreted languages."

+19
source share

Bash is an interpreter according to the GNU Bash reference guide:

Bash is a command line language interpreter or command interpreter for the GNU operating system.

+7
source share

All Articles