Advertisement
hoerigu5g4i3of

Untitled

Sep 26th, 2017
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  1. export COLOR_RED="$(tput setaf 1)"
  2. export COLOR_RESET="$(tput sgr0)"
  3.  
  4. exec 9>&2
  5. exec 8> >(
  6.     perl -e '$|=1; while(sysread STDIN,$a,9999) {print "$ENV{COLOR_RED}$a$ENV{COLOR_RESET}"}'
  7. )
  8. function undirect(){ exec 2>&9; } # reset to original 9 (==2)
  9. function redirect(){ exec 2>&8; } # set to custom 8
  10. trap "redirect;" DEBUG
  11. PROMPT_COMMAND='undirect;'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement