The shell (bash) script doesn’t offer any data type with the variables. So we can’t specifically declare a variable of type boolean in shell scripts.
But, you can still use the variable like a boolean in shell scripts. Store a sample string “true” to a variable and match it with the if condition. This works similarly to boolean.
# Assign a string to a variable
# Test the variable value
if [ "$var" = 'true' ]; then
echo "It's true"
echo "It's false"
So, even if the shell script doesn’t offer the data types, but we can still use the normal variable with similar working.