Advertisement
v1ral_ITS

Colorize bash script example while using variables

Feb 13th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.57 KB | None | 0 0
  1. #!/bin/bash
  2. ################################
  3. # GLOBAL VARIABLES IN ALL CAPS #
  4. ################################
  5.  
  6. # Console colors
  7. W='\033[0m'  # white (normal)
  8. R='\033[31m'  # red
  9. G='\033[32m'  # green
  10. O='\033[33m'  # orange
  11. B='\033[34m'  # blue
  12. P='\033[35m'  # purple
  13. C='\033[36m'  # cyan
  14. GR='\033[37m'  # gray
  15.  
  16. echo -e "$P This $P$B is a $B$G test script $GO$C for colors $C"
  17. echo -e "$P This is purple $GR This is gray $R This is red $O This is orange $P Purple $C Cyan"
  18. echo -ne "This is an example question to use as a variable?: "
  19. read QST
  20. echo -e "$GR $QST"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement