Hello World in Bash

Hello World in Bash Featured Image

Welcome back to yet another article in the Hello World in Every Language series! Today, we’re going to continue the trend of community submissions with Hello World in Bash, a solution shared by Abdus Samad Azad.

Bash Background

According to Wikipedia, Bash is a command language first released back in 1989. Despite its age, Bash is till heavily maintained with changes tracked in git.

In terms of features, Bash supports variables, piping, globbing, control flow, and even iteration. Of those features, perhaps the coolest is globbing—also known as wildcard matching. Globbing can be used to retrieves sets of files that match a wildcard expression.

Beyond that, Bash is ubiquitous in the Linux/Unix/Mac communities. After all, it’s the standard shell on most systems. In fact, it even has support on Windows 10. That means shell scripts are fairly portable. However, users will have to pay attention to code that doesn’t conform the Bourne shell standards.

You’d be hard pressed to find a popular system that doesn’t support Bash today. Even Jenkins, a continuous integration utility, supports Bash scripting during builds.

Hello World in Bash

At any rate, let’s implement Hello World in Bash:

echo Hello, World!

Or, if we want to be a bit more verbose:


echo Hello, World!

As we can see, printing “Hello, World!” in Bash is quite simple. All we do is call the echo command to print the string.

As an added note, the shebang (#!) tells the environment how to run the script. In this case, we want to run the script using Bash. But, we can use this same notation for other languages as well:

#!/usr/bin/env python

print("Hello, World!")
#!/usr/bin/env ruby

puts "Hello, World!"
#!/usr/bin/env node

console.log("Hello, World!")

Here, we have Hello World in Python, Ruby, and Node.js, respectively. Each of these scripting languages can leverage the shebang syntax for easy execution in Unix, Linux, and Mac environments.

How to Run the Solution

If we want to run the solution, we can easily leverage an online Bash shell. To use the tool, we just have to drop our solution into the editor and hit run.

Alternatively, if we have a bash shell available, we can easily download the script, navigate to its folder from the command line, and run it:


In fact, even Windows 10 users can leverage Bash. How-To Geek has a nice tutorial on how to use Bash on Windows 10. If that sounds interesting, check it out!

Sample Programs in Every Language

And, that’s it for Hello World in Bash. If you’re interested in any languages that haven’t made it in the series yet, don’t be afraid to share one in the comments. I’m always looking for new languages to expand the series.

Again, I have to thank Abdus Samad Azad for their contribution to the series. If you’d like to be mentioned in a future article, hop on over to the repository and make your contribution. I always make sure to give my contributors credit.

Oh, one last thing: make sure you share this article if you enjoyed it. I’m sure others will as well!

Series Navigation← Hello World in PicoLispHello World in ALGOL 68 →
Jeremy Grifski on GithubJeremy Grifski on LinkedinJeremy Grifski on PinterestJeremy Grifski on Twitter
Jeremy Grifski
Jeremy grew up in a small town where he enjoyed playing soccer and video games, practicing taekwondo, and trading Pokémon cards. Once out of the nest, he pursued a Bachelors in Computer Engineering with a minor in Game Design. After college, he spent about two years writing software for a major engineering company. Today, he pursues a PhD in Computer Science in order to ultimately land a teaching gig. In his spare time, Jeremy enjoys spending time with his wife, playing Overwatch, practicing trombone, watching Penguins hockey, and traveling the world.

Leave a Comment