BASH shell scripting tips – part 1 : Working with shell variables.

As we know, we used the following syntax will to create a default script bash.

First line: signifies that is the bash script:

Every line and everything after the # is treated as a comment:

A shell variable may be assigned using the following syntax:



Try this command:

Let’s try a simple script. First, we created file with this code:

Let’s see some outputs:

We’ll see how we work with Shell Variables.

Good. Let’s set one.

How set this variable?

First of all, the value of TMOUT…

Now we will set this value to 10

It is 10? Let’s see:

Now the terminal will close in 10 seconds of inactivity.

This is the first part of the tutorial.

Leave a Reply

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