Created
October 4, 2022 07:01
-
-
Save Asraf2asif/0810ab326e4156fc69ea84c78e12f82b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bingo Number Generator | |
echo -e "\n~~ Bingo Number Generator ~~\n" | |
NUMBER=$(( RANDOM % 75 + 1 )) | |
TEXT="The next number is, " | |
if (( NUMBER <= 15 )) | |
then | |
echo $TEXT B:$NUMBER | |
elif [[ $NUMBER -le 30 ]] | |
then | |
echo $TEXT I:$NUMBER | |
elif (( NUMBER < 46 )) | |
then | |
echo $TEXT N:$NUMBER | |
elif [[ $NUMBER -lt 61 ]] | |
then | |
echo $TEXT G:$NUMBER | |
else | |
echo $TEXT O:$NUMBER | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Program that counts down to zero from a given argument | |
echo -e "\n~~ Countdown Timer ~~\n" | |
if [[ $1 -gt 0 ]] | |
then | |
: ' | |
for (( i = $1; i >= 0; i-- )) | |
do | |
echo $i | |
sleep 1 | |
done | |
' | |
I=$1 | |
while [[ $I -ge 0 ]] | |
do | |
echo $I | |
(( I-- )) | |
sleep 1 | |
done | |
else | |
echo Include a positive integer as the first argument. | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Program to tell a persons fortune | |
echo -e "\n~~ Fortune Teller ~~\n" | |
RESPONSES=("Yes" "No" "Maybe" "Outlook good" "Don't count on it" "Ask again later") | |
N=$(( RANDOM % 6 )) | |
function GET_FORTUNE() { | |
if [[ ! $1 ]] | |
then | |
echo Ask a yes or no question: | |
else | |
echo Try again. Make sure it ends with a question mark: | |
fi | |
read QUESTION | |
} | |
GET_FORTUNE | |
until [[ $QUESTION =~ \?$ ]] | |
do | |
GET_FORTUNE again | |
done | |
echo -e "\n$RESPONSES[$N]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -e "\n~~ Questionnaire ~~\n" | |
QUESTION1="What's your name?" | |
QUESTION2="Where are you from?" | |
QUESTION3="What's your favorite coding website?" | |
echo $QUESTION1 | |
read NAME | |
echo $QUESTION2 | |
read LOCATION | |
echo $QUESTION3 | |
read WEBSITE | |
echo -e "\nHello $NAME from $LOCATION. I learned that your favorite coding website is $WEBSITE!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment