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.

Audience

This course is for passionate developers that work with the Unix based operating systems. 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. Space separators are important in Bash. Many times you get error messages that are not telling you where the spaces are missing so you have to guess. The reference doc lack examples. The tutorials you can find on the internet are full of juicy adds and click baits. It is now too late to improve this language. So we must learn it as it is and move on!

HTML Tutorial

Bash Fundamentals @ YouTube


Learn Bash

You can learn Bash fundamental features from our tutorial. If you are first time here, skip the index and read this page to the end. This tutorial is like a book. Do not skip pages and read all the articles slowly to learn all the concepts in the logical order. Read one page every day. When you finish, take the quiz. This is a tough language so let's get started.

Tutorial Index

  1. Syntax Overview
  2. Shell Console
  3. Shell Commands
  4. Command Groups
  5. Data types
  6. Arithmetic Expressions
  7. Brace Expansion
  8. Arrays
  9. Conditional Expressions
  10. Control Flow
  11. Functions
  12. Regular Expressions
  13. File Handling
  14. Asyncronous Processes
  15. External Commands

Running 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

Examples

We have create examples on github and on repl.it 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.

References

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.

Next page: Syntax Overview