Skip to content

Instantly share code, notes, and snippets.

@rivernate
Created May 5, 2021 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rivernate/ba78d108f1eb251126bb65de4d2b0360 to your computer and use it in GitHub Desktop.
Save rivernate/ba78d108f1eb251126bb65de4d2b0360 to your computer and use it in GitHub Desktop.
Bash Script cheat sheet
#!/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