Create a Variable in Ubuntu Server 20.04 Bash Shell

This blog post will show you how to create a variable in Ubuntu Server 20.04 Bash Shell and use it.

Use Bash

Behind the scenes, Bash is not just a Shell to run commands; it is a complete scripting engine that allows us to write mini-programs made of scripts. Therefore using variables is essential.

Bash allows us to create a run time variable and later on use them to store values.

Create a Variable

The variable can be anything and Bash allows us to create variables that contain strings, integers, lists and more. To create a variable in Bash shell I will type the following command



Once the variable has need created, I can view the variable using the following command.

echo $testvar

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.