
Master bash shell scripting by building reusable scripts, making them executable as standalone commands, and automating tasks with variables, if statements, for loops, user input, and command line arguments.
Define Bash and the shell as a program that interprets commands and offers a programming language. Learn to echo environment variables, use an interactive terminal, and run plain text scripts.
Create your first bash shell script by writing an echo command to print hello bash, save as a .sh file, and run it with bash to see the output.
Make a shell script executable by using chmod u+x and adding a shebang. Run it via absolute or relative paths, and learn how missing permissions or a shebang causes errors.
Use a shell script as a single command by adding its directory to your path and exporting path, then run it without an extension. Persistence requires updating your shell configuration.
Define variables by naming them, assign value with an equals sign, and reference them with a dollar sign. Expand only in double quotes and avoid spaces around the equals sign.
Explore environment variables in bash, contrast them with local shell variables, and learn key names like home, user, pwd, and hostname, plus path, noting they are uppercase and usually immutable.
Learn how environment variables in all caps are a convention, not true constants. Use a read-only variable to enforce a true constant; attempting changes triggers an error.
Learn how to use comments in bash scripts by prefixing lines with a pound sign and using inline comments; bash has no multi-line comments, so every line must be prefixed.
Explore how positional parameters pass command-line information to a bash script, access them with $1, $2, and use $@ to handle all arguments, including quoted ones.
Define a bash function with a name, parentheses, and curly braces, using underscores by convention. Call the function by name, pass positional arguments, and use local variables to avoid pollution.
Validate script arguments with if statements, check for an empty parameter list, use an else clause, and explain exit statuses, zero for success and non-zero for errors.
Learn how to replace a single argument with a for loop to process multiple positional parameters, using for, in, and done, and call say hi for each name.
You completed the Bash shell scripting course and explored best practices in shell scripting. Share your feedback or a review to help future learners and stay tuned for more courses.
I have been running on Linux based operating systems for years now, and even though the Bash shell was pretty scary at first it is such a powerful tool. Once you can get around with your terminal emulator, the next step is learning how to write simple shell scripts. I hope I can help you get up to speed with that!
Bash has been the default terminal on Linux based systems for decades now. Although other shells like Zsh and Fish are getting more popular now, the best first step in learning shell scripting is still Bash.
During this course I will teach you:
Learn shell programming with bash
Learn how to create shell scripts for Linux and Mac
Automate repetitive tasks with shell scripts
Getting familiar with lots of shell commands.
About Me
My name is Koen, it is nice to meet you. Starting out at the age of 15 with iOS development I never lost my interest in Software Development. Currently I mainly keep myself occupied with web development. I am invested in multiple backend technologies and frameworks, such as Ruby on Rails, Django and Laravel. On the frontend side of projects I follow the development of React, Alpine.js and Vue.js closely.