garabik / grc

generic colouriser
http://kassiopeia.juls.savba.sk/~garabik/software/grc.html
Other
1.9k stars 162 forks source link

Don't require STDIN STDOUT to be tty #200

Open HaleTom opened 2 years ago

HaleTom commented 2 years ago

I have a loop which reads a list of files to source from stdin, and redirects output to an error file.

As such, tty -s will be false for me.

Please change:

if tty -s && [ -n "$TERM" ] && [ "$TERM" != dumb ] && [ -n "$GRC" ]; then       

to:

if [ -n "PS1" ] && [ -n "$TERM" ] && [ "$TERM" != dumb ] && [ -n "$GRC" ]; then