Created
May 5, 2021 16:54
-
-
Save rivernate/ba78d108f1eb251126bb65de4d2b0360 to your computer and use it in GitHub Desktop.
Bash Script cheat sheet
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
#!/usr/bin/env bash | |
## Font weight | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
## Font colors | |
red=$'\e[1;31m' | |
grn=$'\e[1;32m' | |
end=$'\e[0m' | |
## Read input with colorized text prompt | |
read -rp "${grn}Proceed?${end} (only ${red}${bold}yes${normal}${end} will be accepted): " proceedvar | |
## printf example of using font colors and weight | |
printf "\n%s\n" "${bold}Processing:${normal} ${red}$somevar${end}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment