Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Entertaining. Maybe hide the stack traces and just show the error messages:

    $ cat nonexistent
    cat: nonexistent: No such file or directory

    $ lolcat nonexistent
    /usr/lib/ruby/gems/1.9.1/gems/lolcat-42.0.21/lib/lolcat/cat.rb:57:in `initialize': No such file or directory - nonexistent (Errno::ENOENT)
    	from /usr/lib/ruby/gems/1.9.1/gems/lolcat-42.0.21/lib/lolcat/cat.rb:57:in `open'
    	from /usr/lib/ruby/gems/1.9.1/gems/lolcat-42.0.21/lib/lolcat/cat.rb:57:in `block in cat!'
    	from /usr/lib/ruby/gems/1.9.1/gems/lolcat-42.0.21/lib/lolcat/cat.rb:55:in `each'
    	from /usr/lib/ruby/gems/1.9.1/gems/lolcat-42.0.21/lib/lolcat/cat.rb:55:in `cat!'
    	from /usr/lib/ruby/gems/1.9.1/gems/lolcat-42.0.21/bin/lolcat:24:in `<top (required)>'
    	from /usr/bin/lolcat:19:in `load'
    	from /usr/bin/lolcat:19:in `<main>'
Also:

    $ echo 'text' > tmp && stat -c %s tmp
    5
    $ echo 'text' | grep --color text > tmp && stat -c %s tmp
    5
    $ echo 'text' | lolcat > tmp && stat -c %s tmp
    80
grep seems to know when the output is going to a file rather than the terminal (I honestly have no clue how) and omits the color control sequences. lolcat does not, which prevents it from being used instead of cat in some cases.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: