What is bash script?

Share this post to your friends !

This entry is part 2 of 6 in the series Writing your first script

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

Continue reading the series«« Previous part: What is shell script?Next part: How to write a bash script »»
If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.


Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner
«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.