Variable Assignment & Expansion

Get yourself accustomed to variable assignment and expansion.

How to set a variable?

Variables usually come in handy when you need to store or retieve something during program execution. To assign a value to a variable we use “=” operator. In Bash, you do not need to declare the type of a variable unlike C++ and JAVA. Which means you can assign any value to a variable whether it is a number, a character or a string of characters.

Some variables are preset by the system but we can set our own variables as well. The syntax to assign value to a variable is given below:

Get hands-on with 1200+ tech skills courses.