Comments

A single line comment is written using a #.

#! /bin/bash
# This is a single line comment
echo "Hello world" # This is also a comment


Variables

<aside> 📌 The name of a variable can contain only letters (a to z or A to Z), numbers (0 to 9) or the underscore character (_). Also, the variable name cannot start with a number.

</aside>

System Variables

User Variables

Deleting a variable

The unset command can be used to delete a variable.

Example:

#! /bin/bash
my_var=10
echo "Value: $my_var"

unset my_var
echo "Value: $my_var"
$ ./delete-variables.sh 
Value: 10
Value:

Arrays