Member-only story
Linux — Shell Scripting Basics
The purpose of this hands-on training is to teach you how to script in shell.
Learning Outcomes
At the end of this hands-on training, you will be able to;
- explain shell scripting basics.
- explain shell variables.
- do simple arithmetic.
Outline
- Part 1 — Shell Scripting Basics
- Part 2 — Shell Variables
- Part 3 — Simple Arithmetic
Part 1 — Shell Scripting Basics
- Create a folder and name it shell-scripting.
mkdir shell-scripting && cd shell-scripting- Create a
scriptfile namedbasic.sh. Note all the scripts would have the .sh extension.
#!/bin/bash
echo "Hello World"- Before we add anything else to our script, we need to alert the system that a shell script is being started. This is done specifying
#!/bin/bashon the first line, meaning that the script should als be run with bash, rather than another shell.#!is called ashebangbecause the#symbol is called a hash, and the!symbol is called a bang. - After to save the above content, we need to make the script executable.






