Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Continuous bash script to do tasks

opt=y
while [ $opt = y -o $opt = Y ]
do
        echo -e "Enter first  number: c"
        read -r a

if [ $(bc <<< "$a > 0.0 && $a > 0") ]; then
        result=$(bc <<< "scale=2; $a * $a")
        echo "Square of $a: $result"
else
        echo "Bitch, put a number. Nothing else."
fi

echo -e "Want to continue? [y/n] c"
read -r wish

if [ $wish == y -o $wish == Y ]; then
        continue
else
        exit
fi

done
 
PREVIOUS NEXT
Tagged: #Continuous #bash #script #tasks
ADD COMMENT
Topic
Name
1+3 =