Scripting resources

Learning a scripting language is an intimidating task. It also takes time, because practice is the only way to master a skill propertly and you will need to do and re-do your code to learn (new techniques and from your mistakes).

By the end of this article, you will have:

  • A list of online tutorials to sharpen your skills
  • Reference guide for Bash scripting
  • Best practices to write code and to make it more secure
  • And resources to edit and execute Bash scripts when you don't have access to a Linux machine.

This is not a complete guide, but it will serve you as a start point to more resources.

Online tutorials

Nothing beats like a detailed explanation from someone more experienced, specially if is with examples.

Reference guide

Sometimes you want to learn how to perform a specific task without distractions. Also what is better than the official way of solving things?

As they say RTFM (Read The Fine Manual):

  • GNU Bash Manual: This is the bible of bash. With consise examples, organized by topic. You will keep coming back to this guide over and over.

Also if you are on linux you must learn to use the following two commands:


'The GNU Bash Reference Manual', for 'Bash'

info bash


# bash - GNU Bourne-Again SHell
man bash

Check your Bash code

You want to learn how to write efficient code, avoid common mistakes and also make sure your scripts are secure!. Fear not, there are plenty of resources out there to learn basic and advanced skills:

  • ShellCheck - A shell script static analysis tool: You must install this tool. Can be used online but its true power comes when you integrate it with VIM, IntelliJ IDE. You will be surprised how you managed to live without this for so long...
  • OWASP Command Injection: Command injection is commonly used to elevate privileges on scripts or programs that do not sanitize user input. Don't be a victim and learn how to write secure code. Also, on the topic of security, you should learn about a (old, hopefully not relevant anymore) remote vulnerability exploit called Shellshock and how you may be affected if your version of bash is old or your code doesn't sanitize user input.

Code repositories

The following repositories contain Bash scripts, written in a way that you can learn specific topics by checking the code. All the code is Open Source and you can copy and paste the examples to learn.

Keep in mind than code in repositories like GitHib may contain bugs. Also be very careful not to download and run code as the super user or you may find yourself in a pickle.

Online code execution

What if you want to try something, but you don't have access to Linux/ Unix? This is less than ideal but can also try a few online resources that have a very nice front end where you can run your scripts.

  • Syntax support, run the code from your browser and also supports multiple languages. Very convenient, specially if you don't have access to Linux to test a simple script
  • Bash online compiler: You can run here bash scripts directly from your browser, with a few restrictions. It has a nice Syntax color support
  • LeetCode: Has a nice playground where you can write Bash scripts (and many other languages), and if you want you csn try to solve some of the challenges (paid/ free subscription).

Wrap up

We covered several online resources that will help you to become a better Bash programmer. For that keep in mind: * Learn basic concepts by looking at the online tutorials, but do always check the reference guide. They have the ultimate trust (well, almost always :-)) * Avoid common mistakes by checking SpeelCheck and OWASP websites. You will thanks yourself later * Learn by example by looking how others solve common problems (in places like GitHub). But also be critic and if you find a bug, then contribute and report it or even better, submit a patch. * Do not forget that practice is the best way to learn something, so go ahead and start writting a few scripts!