Re:Colout – add colors to a text stream in your terminal
by nojhan on Thursday June 06, 2013 @03:41PM
(#5834697)
You can, it's just a matter of knowing how to write a function for your shell.
[ Parent
| on HN ]
Re:Colout – add colors to a text stream in your terminal
by nillian on Friday June 07, 2013 @09:30AM
(#5838724)
Exactly.
ls example in zsh:
alias ls="ls -lph1 --color=always"
function ls {
/bin/ls $@ | colout [regex] colours
}
This will pass all arguments after "ls" to the /bin/ls command. This also means you can keep your existing aliases clean and tidy for common params.Remember to use the full path (or /usr/bin/env maybe) so that you don't create a recursive call to your function ;)
This doesn't deal with the situation of being unable to get the return value of the original command, but depending on your needs, this may not be an issue.
(edited for spacing)
Re:Colout – add colors to a text stream in your terminal
by lobster_johnson on Friday June 07, 2013 @09:54AM
(#5838890)
I was referring to the exit code problem. Is it solvable?