Advertisement
hoerigu5g4i3of

Untitled

Sep 26th, 2017
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.40 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.     while IFS='' read -r -d $'\0' line || [ -n "$line" ]; do
  7.        echo -ne "${COLOR_RED}${line}${COLOR_RESET}"
  8.     done
  9. )
  10. function undirect(){ echo -ne '\0' >&8; exec 2>&9; } # reset to original 9 (==2)
  11. function redirect(){ exec 2>&8; } # set to custom 8
  12. trap "redirect;" DEBUG
  13. PROMPT_COMMAND='undirect;'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement