What is bash script?

by Daniel Pham
Published: Updated:
This entry is part 2 of 6 in the series Writing your first script

This article will introduce to you about Bash and Bash scripts. Actually, we’re just talking about Bash and the Bash script is just a form of Bash. Then what is Bash? And why Bash was born?

What is Bash?

Bourne Again Shell, written by Brian Fox as part of a GNU project for replacing sh, was released sometime in around 1989. It provides a number of utilities and is the default shell. Used on Linux, Mac OS X, Darwin today. This will be the object we use and experience.

Bash was born to revive Bourne Shell. Like the Unix shell #, Bash supports wildcard (*), pinname, and so on, and can read commands from text files called scripts. Bash over the shell # is that it’s designed to be open, support POSIX command so extensions are boundless and free, so it should be used on most current Unix-like OSs like Darwin (MAC), Redhat, etc.

What is bash script?
Display shell in Linux.

Read moreWhat is shell script?

Bash may be the first instance of sh (although it precedes the POSIX standard for several years), but over time it has had many extensions. Many extended changes may not handle the POSIX standard, since bash itself is not a valid POSIX shell. Instead, it is a dialect of the POSIX shell language.

Bash supports conversion to –posix, makes bash valid and conforms to POSIX standards. It also tries to mimic POSIX if called as sh.

What is a Bash script?

As in previous posts I also talked about shell scripts. Script is essentially a file that represents the user’s commands in order.

Bash (or other shells) will read the script from top to bottom, find the commands in the file and execute it.

Bash is sh?

For a long time, /bin/sh points to /bin/bash on most GNU/Linux systems. As a result, it has become almost safe to give up the difference between them. But that has changed recently.

Some common examples of systems /bin/sh do not point to /bin/bash (and some of them /bin/bash may not even exist):

  • Modern Debian and Ubuntu systems, where the default symlink sh points to the dash;
  • Busybox, usually run during Linux system boot, as part of initramfs. It uses ash shell.
  • BSDs: OpenBSD uses pdksh, a descendant of the Korn shell. sh of FreeBSD is a descendant of the UNIX Bourne shell.

(This is based on a partial answer on StackOverFlow).

Conclusion

Through this article, I hope you can understand what Bash is and what the Bash script is. Why Bash was born. In the next article, we will learn how to use bash and write bash scripts.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

Writing your first script

What is shell script? How to write a bash script
0 0 votes
Article Rating

You may also like

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.