Shell Scripting- Data types

Shell Scripting- Data types.

in the case of Bash, you don’t have to define the data type of any variable at the time of variable declaration. Bash variables are untyped, which means just type the variable name by assigning its value, and it will automatically consider that data type.

Such that if you assign any numeric value to the variable, it will work as an integer, and if you assign a character value to the variable, then it will be String.

  1. year=2012
  2. comp_name=jtp

using echo command, read them by assigning $ sign before their name such as

echo$year

echo $name

Leave a Comment