JCX
JCX

Reputation: 1449

What is the difference between Batch and Bash files?

What are the differences between Batch and Bash?

How are they being used?

Upvotes: 42

Views: 89847

Answers (4)

Dennis Williamson
Dennis Williamson

Reputation: 360683

"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.

Upvotes: 11

Breton
Breton

Reputation: 15592

"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.

Upvotes: 41

Barun
Barun

Reputation: 2662

Bash is actually a shell in UNIX/Linux. Batch files (or batch jobs) are usually referred to files containing list of commands executed periodically (daily, weekly, etc). You can write batch jobs in any language (example, Python, PHP, Perl, Shell script). Bash shell also supports scripting. So, you can write batch files with Bash scripting also.

This is a broad idea without dealing with too much intricacies. :)

Upvotes: 7

tkalve
tkalve

Reputation: 3196

Bash is a Unix shell. A bash file is a batch file, but not the other way around. A batch file is a text file containing a series of commands.

Upvotes: 5

Related Questions