Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Good Afternoon,

(OS X user)

I am specifically trying to pipe the output of every shell command I type into the ruby gem 'lolcat' (which makes the output to the terminal rainbow colored).

Is there a way to do this without explicitly aliasing command individually? I was thinking perhaps there might be a way to pipe anything before the return key is pressed , but I am not sure how to do this.

Your assistance is appreciated, as I am tired of looking at just one color in my terminal.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can redirect stdout in your shell:

exec 1> >(lolcat)

BUT

if lolcat sends its own output to stdout, you're bound to run into problems. This might work

exec 1> >(lolcat >&2)
share|improve this answer
    
Thanks Glenn! How would I incorporate this into my .bashrc, alias the exec command? –  user1442303 Aug 8 '13 at 15:13
    
I'm not sure that's working, so I'd explicitly turn it on (don't make it the default behaviour): lol() { exec 1> >(lolcat); } and to turn it off: unlol() { exec 1> /dev/stdout; } –  glenn jackman Aug 8 '13 at 15:21
    
I'm sure there will be some issues (I've noticed when turned on programs like 'nano' will not work), but this is exactly what I was looking for. Thank you. –  user1442303 Aug 8 '13 at 15:35
    
I feel like you want to shoot yourself in the foot and I just gave you the gun. Good luck. –  glenn jackman Aug 8 '13 at 15:42
    
At the risk of accidentally doing something I'll regret (which now seems to be much higher than usual), I'm leaving it off and just aliasing ls for now. –  user1442303 Aug 8 '13 at 15:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.