Possible Duplicate:
Piping data to Linux program which expects a TTY (terminal)
I want to display colors from script that is non interactive and I need to tell the shell that in fact my script is a terminal that support colors so command like ls --color=auto
will display colors (ls have option --color=always
but I would like to support for all posible commands that support colors as well).
I call my shell via python Popen. I've try to set TERM environment variable but It don't work.
subprocess.Popen(['/bin/bash', '-c', command],
env={'TERM':'xterm-color'},
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Is there a way to tell bash that I'm a terminal?