Преобразование в строку

Простые типы / Логический тип

#the true and false of bash are words, so the value is a string already
sunIsStar=true
strSun="$sunIsStar"
#strSun is "true"

#the result of a condition is its exit code, $? gives it as a number;
#unlike C, the false is 1 and the true is 0
[[ "Earth" == "star" ]]
strEarth=$?
#strEarth is "1"

#a word is picked with && and ||
[[ "Earth" == "star" ]] && strEarthWord=true || strEarthWord=false
#strEarthWord is "false"

echo "strSun is $strSun"
echo "strEarth is $strEarth"
echo "strEarthWord is $strEarthWord"