40 lines
875 B
Bash
40 lines
875 B
Bash
|
#!/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
|