How To Set Get and Change Bash Environment Variable?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/set-get-change-bash-environment-variable/
PINTEREST
PINTEREST
INSTAGRAM

Bash shell is used for a lot of things in Linux systems. Most of the applications run with bash. Bash is a shell but provides an environment that can be used to programming. Variables are core of the programming. Bash provides variables too. There are default variables as well as user defined variables.

Get Existing Bash Environment Variables

Bash provides a lot of variables by default. Those variables can be used to get information about shell, system, running applications etc. We can list all ready created environment variables with the env command like below.

Get Existing Bash Environment Variables

Get Existing Bash Environment Variables

Create and Set Variable

Creating and setting a variable in bash is very easy. We just need to specify the variable name and set the value with equal sign like below. In this example we will create a variable named count and set its value integer .

Get Variable

Getting a variable values is very easy we just need to add $ to the start of the variable name. In this example we will print the count variable value.

Change Variable

We can change all ready created variables value. It is the same way of creating a variables. So we will just provide the variable name the the value. In this example we will set variable count to the 1.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/set-get-change-bash-environment-variable/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  Linux Livbirt Terminology

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)