Guest User

Untitled

a guest
Oct 20th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. red=$'e[1;31m'
  2. grn=$'e[1;32m'
  3. yel=$'e[1;33m'
  4. blu=$'e[1;34m'
  5. mag=$'e[1;35m'
  6. cyn=$'e[1;36m'
  7. end=$'e[0m'
  8.  
  9. printf "%sn" "Text in ${red}red${end}, white and ${blu}blue${end}."
  10.  
  11. shw_grey () {
  12. echo $(tput bold)$(tput setaf 0) $@ $(tput sgr 0)
  13. }
  14.  
  15. shw_norm () {
  16. echo $(tput bold)$(tput setaf 9) $@ $(tput sgr 0)
  17. }
  18.  
  19. shw_info () {
  20. echo $(tput bold)$(tput setaf 4) $@ $(tput sgr 0)
  21. }
  22.  
  23. shw_warn () {
  24. echo $(tput bold)$(tput setaf 2) $@ $(tput sgr 0)
  25. }
  26. shw_err () {
  27. echo $(tput bold)$(tput setaf 1) $@ $(tput sgr 0)
  28. }
  29.  
  30. print red; echo -e "e[31mfooe[m"
  31.  
  32. autoload -U colors
  33. colors
  34.  
  35. echo $fg[green]YES$fg[default] or $fg[red]NO$fg[default]?
  36.  
  37. #!/bin/bash
  38.  
  39. red='e[1;31m%se[0mn'
  40. green='e[1;32m%se[0mn'
  41. yellow='e[1;33m%se[0mn'
  42. blue='e[1;34m%se[0mn'
  43. magenta='e[1;35m%se[0mn'
  44. cyan='e[1;36m%se[0mn'
  45.  
  46. printf "$green" "This is a test in green"
  47. printf "$red" "This is a test in red"
  48. printf "$yellow" "This is a test in yellow"
  49. printf "$blue" "This is a test in blue"
  50. printf "$magenta" "This is a test in magenta"
  51. printf "$cyan" "This is a test in cyan"
  52.  
  53. var_color_black=0
  54. var_color_red=1
  55. var_color_green=2
  56. var_color_yellow=3
  57. var_color_blue=4
  58. var_color_magenta=5
  59. var_color_cyan=6
  60. var_color_white=7
  61.  
  62. function colorBlue(){
  63. tput setaf $var_color_blue;
  64. # tput setab $var_color_white; # Uncomment for white background
  65. }
  66. function resetColor(){
  67. echo $(tput sgr0) ;
  68. }
  69.  
  70. colorPath ;
  71. echo -n "hello world" ; # -n because resetColor echoes a newline
  72. resetColor ;
Add Comment
Please, Sign In to add comment