Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Batch and Bash files?

What are the differences between Batch and Bash?

How are they being used?

like image 974
JCX Avatar asked Feb 22 '11 14:02

JCX


People also ask

Is .bat a Bash file?

A Bats test file is a Bash script with special syntax for defining test cases. Under the hood, each test case is just a function with a description. Bats is most useful when testing software written in Bash, but you can use it to test any UNIX program.

What is the difference between batch files and shell scripts?

The Batch File adapter processes a (Windows) batch file as the data source of an input map card or the data target of an output map card. The Shell Script adapter processes a (UNIX) shell script as the data source of an input map card or the data target of an output map card.

What is the difference between file and batch file?

Both of these are proper programming languages whereas batch files are basically a collection of console commands. Instead of typing the same commands repeatedly, you place them into a batch file and run that file "as a batch of commands", hence the name.


2 Answers

"Batch File" is terminology normally used for a text file containing a sequence of MSDOS shell commands. Bash is a unix shell, and normally the equivalent term for unix to "Batch File" is "Shell Script", or simply "Script".

I've never heard the term "Bash file", though it makes some logical sense, usually "Shell Script" or "Bash Script" is used instead.

like image 117
Breton Avatar answered Sep 28 '22 18:09

Breton


"Batch" can mean several things (ignoring the general, non-technical definitions):

  • A file containing MS-DOS or Windows command shell instructions in the form of a script. These will have filenames ending in ".BAT" for DOS or Windows or ".CMD" for Windows.

  • Linux/Unix also has a batch command. This is used to schedule the execution of a process when the system load falls below a threshold.

  • Generically, a set of processes run as a group. This definition may be a little more tied to older systems such as those using punched cards, etc.

From man bash:

Bash is an sh-compatible command language interpreter 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).

It's typically used on Linux or Unix (including OS X) systems, but it can be used on others, including Windows.

like image 33
Dennis Williamson Avatar answered Sep 28 '22 16:09

Dennis Williamson