Linux Bash How to Define, Use Shell Variables

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-bash-define-use-shell-variables/
PINTEREST
PINTEREST
INSTAGRAM
  1. Introduction To Linux Bash Programming
  2. Linux Bash Directories and Files
  3. Linux Bash Environment Variables
  4. Linux Bash Variables
  5. Linux Bash Functions
  6. Linux Bash If Else Conditionals
  7. Linux Bash Create and Run Script Files
  8. Linux Bash Operators
  9. Linux Bash Arrays
  10. Linux Bash Input, Output and Redirection
  11. Linux Bash History
  12. Linux Bash Alias
  13. Linux Bash .bashrc File
  14. Linux Bash Debugging

Variables are programming part of the bash and very useful. Without variables bash will be very inefficient shell. Variables are used by bash itself, running applications, daemons, X (graphic) server and for a lot of things.

Define Variable

Defining variables are easy in bash, just variable and data is enough. echo is used to print variables into terminal. With equal sign variable values are set. As you see page, Page, PAGE are different variables this means bash is case sensitive.

Delete/Undefine Variable

Sometimes we don’t need variables that are created before and we want simple delete them. unset keyword is used to delete variable completely.

Change Variable Value

There is no extra effort to change existing variable value. It is just like creating new variable

Concatenate Variables

To join variables together just put them together. In the second echo we put one space between hello and poftut variables which effects printed string too.

LEARN MORE  Linux History Command Tutorial with Examples

We create two variables named hello and poftut. Than we echo both by joining together without any operator.In the second echo we put single space between them and then join all of them together.

  1. Introduction To Linux Bash Programming
  2. Linux Bash Directories and Files
  3. Linux Bash Environment Variables
  4. Linux Bash Variables
  5. Linux Bash Functions
  6. Linux Bash If Else Conditionals
  7. Linux Bash Create and Run Script Files
  8. Linux Bash Operators
  9. Linux Bash Arrays
  10. Linux Bash Input, Output and Redirection
  11. Linux Bash History
  12. Linux Bash Alias
  13. Linux Bash .bashrc File
  14. Linux Bash Debugging
RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-bash-define-use-shell-variables/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.