Sage-Code Laboratory

Shell Programming

Bash is a domain specific programming language. It is the default scripting language UNIX systems. It is open source and available on FreeBSD, Mac OS and Linux. This should be your first programming language to master system programming and Linux command line. Bash is the successor of Shell script, therefore is also called Shell scripting language.


This course is for passionate developers that work with the Linux operating system or Mac owners. Usually a Software Engineer that know Bash work as TechOps Software Engineer and have a highly payed job. Bash language is not recommended for enterprise developers. If you want to become a regular application developer and not a system developer, we advice you to learn other language and let Bash for later.

What is wrong?

Bash has a weird syntax that may be difficult to master. Bash is interpreted not compiled and has dynamic types. Bash is not a free form language. Using spaces or not using spaces is important in Bash. Many times you get error messages that are not telling you what the problem is so you have to guess. The reference doc lack examples and is poorly explained. The tutorials you can find on the internet are full juicy adds and click baits. We will try to make all this pain go away by making a good add free tutorial but we can't improve the language. It is too late and it's going to be so for eternity. Nobody will touch it. So we learn it as it is, and use it only for what is good at: small system scripts!

HTML Tutorial

Darek Banas: YouTube

Learn Bash

You can learn Bash from our next tutorial and references that we provide below. If you are first time here, skip the index and read this page to the end. We will help you navigate to next page and read all tutorial like a book. Do not skip pages and read all the articles thorough to learn all the concepts in logic order. Read one page every day. When you finis, take the quiz. This is a tough language so let's get started.

Tutorial Index

  1. Syntax Overview
  2. Data types
  3. Shell Arithmetic
  4. Conditional Expressions
  5. Bash Arrays
  6. Control Flow
  7. Functions
  8. Command Expansion
  9. Shell Command Line
  10. Builtin Commands
  11. File Handling
  12. Directory Stack
  13. Brace Expansion
  14. Regular Expressions

Run Bash

On Linux and MacOS, you can run Bash scripts using the Terminal Window or Command Window. Also, the operating system can run Bash scripts at startup. These are maintained by the Administrator of a computer and they are used to start services or set-up the system environment.

On Windows 10, Bash can be run in native mode. In older version of Windows we use to have emulators of Bash that can still be used today. You must install WSL (Windows System 4 Linux) that is available as a Windows feature. If you enable this feature you can install bash from Windows App store. Also there are several other solutions to run shell scrits on Windows: mingw, cygwin, git-bash


We have create examples on github and on websites. You can visit these resources to investigate the code and understand better the language syntax. We appreciate any contribution to improve the code and the articles.


Our tutorial is work in progress and do not cover all bash syntax and features. Until we improve our tutorial to full strength, you can continue learning Bash from external references. These are the best references we have found searching the internet. No ads!

Bash Quiz

Next quiz does not have a time limit, but you should finish in less than 30 minutes. You can scan the code using a mobile or tablet. If you are already on mobile device, tap the code below to start the quiz. It requires you to sign-in using your Google account.
Bash Quiz

Bash - Quiz

Privacy Terms: We do not collect your e-mail address but we record your name with the test results on Google drive. If you take more than 80% we will recognize your skill and will endorse you on Linked-in. If you don't agree, you can use name: Anonymous or a fake name but then we can't endorse your new skills.

Go back: Tutorial Index