Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # repeatIT
- # Get's a color, phrase, and count
- # then prints phrase in the chosen color
- # x amount of times
- # uses looped option menu
- # By: Brian McCumber
- clear
- nc='\033[0m' # No Color
- echo -e "Repeat IT\n"
- echo "Pick a color: 1-5. 5 is Exit"
- OPTIONS="Red Green Yellow Blue Exit"
- select opt in $OPTIONS; do
- if [ "$opt" = "Red" ]; then
- colr='\033[0;31m'
- read -p "Type in phrase to repeat: " txt
- read -p "How many times to repeat: " tms
- for (( i = 1 ; i <= tms; i++ ))
- do
- printf "${colr}$txt "
- sleep .005
- done
- printf "${nc}\n"
- elif [ "$opt" = "Green" ]; then
- colr='\033[0;32m'
- read -p "Type in phrase to repeat: " txt
- read -p "How many times to repeat: " tms
- for (( i = 1 ; i <= tms; i++ ))
- do
- printf "${colr}$txt "
- sleep .005
- done
- printf "${nc}\n"
- elif [ "$opt" = "Yellow" ]; then
- colr='\033[0;33m'
- read -p "Type in phrase to repeat: " txt
- read -p "How many times to repeat: " tms
- for (( i = 1 ; i <= tms; i++ ))
- do
- printf "${colr}$txt "
- sleep .005
- done
- printf "${nc}\n"
- elif [ "$opt" = "Blue" ]; then
- colr='\033[0;34m'
- read -p "Type in phrase to repeat: " txt
- read -p "How many times to repeat: " tms
- for (( i = 1 ; i <= tms; i++ ))
- do
- printf "${colr}$txt "
- sleep .005
- done
- printf "${nc}\n"
- elif [ "$opt" = "Exit" ]; then
- clear
- echo -e "Thanks for using Repeat IT, goodbye...\n"
- exit
- else
- clear
- echo -e "Repeat IT\n"
- echo "You entered a Bad Option"
- echo "Options: 1 = Red, 2 = Green, 3 = Yellow, 4 = Blue, 5 = Exit"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement