ScriptingLesson 47Free preview
Bash Data Types
This lesson is part of Bash · All levels
Summary
Bash is a language without strict data types, all values are basically stored as strings including numbers. Arithmetic operations are performed within the arithmetic expression or let command, whereas tests such as -n and -z check the string. You can force the type by declare -i to an integer.
Key points
- All the base values are stored as strings
- Declare -i marks the variable as an integer
- Arithmetic expression $(((a + b)) counting numbers
- Test -n and -z check whether the string is empty or not
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.