Chapter #4: How to Work with Variable Types and User Input in Bash
Learn how Bash handles data types like strings and integers, and discover how to make your scripts more dynamic using user input and default values.

At this point, you may get the idea that Bash scripting is a simple and fun language to learn and use. In the last lesson, we learned how to use variables.
We are going to continue our journey with another important concept related to variables, which we call data types.
Unlike other programming languages, Bash scripting doesnβt have data types like integers, floats, and booleans.
Everything in Bash, by default, is a string, and depending on how you use it, the interpreter could interpret it differently.
In this lesson, we will learn how to use data types in Bash with some examples and tricks for working with variables.
What Is a Data Type in Bash?
By "data type", we mean the type of value that we store inside a variable. If you already know a programming language, you will know that there are a bunch of types, such as strings, integers, and floats.
Every variable we declare has a type; it may be a string, float, or integer.

However, by default, variables in Bash are strings. You may need extra steps to tell Bash that a variable is a different type.
Since Bash does not have a mechanism to define the type of a declared variable during initialization, unlike other programming languages where you specify the type within the declaration, this requires additional handling.