Tyleo-Dev-ShellScripting-Ol.../SH/additionvar.sh

40 lines
875 B
Bash
Raw Permalink Normal View History

2024-02-18 21:29:57 +00:00
#!/usr/bin/env bash
number=1
echo "
███████████████████████████████
█This script will add your █
█custom value to the variable █
\$number, enter your value █
█ █
█it will echo result to you ! █
█ █
█Starting value : 1 (number=1)
███████████████████████████████
"
echo $number
while true
do
echo -n "Your value : "
read add
if [[ "$add" =~ [0-9] ]]; then
let "number += add"
echo $number
if [[ $number -ge 1000 ]]; then
echo "Limit reached!"
echo Aborted
exit
fi
elif [[ $add = [Ee]xit ]]; then
exit
elif [[ $add = EXIT ]]; then
exit
elif [[ $add = [Qq]uit ]]; then
exit
elif [[ $add = QUIT ]]; then
exit
else
echo "Numbers only"
exit
fi
done