Advertisement
devinteske

bashing a lolcat ;D (or a cowsay)

Jul 27th, 2015
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.08 KB | None | 0 0
  1. ### OBSOLETED BY http://druidbsd.cvs.sf.net/viewvc/druidbsd/home/bash_profile?view=markup ###
  2.  
  3. devin@localhost ~ $ preexec(){ cmd=$( exec 2>&-; history | /usr/bin/tail -1 ); cmd="${cmd#*[0-9]  }"; cmd="${cmd%%[$IFS]*}"; fcmd=; case "$cmd" in *[^[:alnum:]_]*) return; esac; case "$( exec 2>&-; type $cmd )" in *builtin*|*keyword*) case "$cmd" in echo|printf) fcmd="builtin $cmd" ;; *) return; esac;; *) fcmd=$( which $cmd ); esac; [ "$fcmd" ] || return; unset -f $cmd 2> /dev/null; if [ "$LOLCAT" ]; then unalias $cmd 2> /dev/null; eval "$cmd(){ $fcmd \"\$@\" | $LOLCAT; }"; fi; }
  4. devin@localhost ~ $ trap preexec DEBUG
  5. devin@localhost ~ $ LOLCAT=cowsay
  6. devin@localhost ~ $ echo hi
  7.  ____
  8. < hi >
  9.  ----
  10.         \   ^__^
  11.          \  (oo)\_______
  12.             (__)\       )\/\
  13.                 ||----w |
  14.                 ||     ||
  15. devin@localhost ~ $ ls /etc/periodic/
  16.  _______________________________
  17. < daily monthly security weekly >
  18.  -------------------------------
  19.         \   ^__^
  20.          \  (oo)\_______
  21.             (__)\       )\/\
  22.                 ||----w |
  23.                 ||     ||
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement