[TxMt] Re: Shell script colors work from Terminal, not when run from TM
mailinglist at textmate.org
Thu Jan 17 06:42:19 UTC 2013
On Jan 17, 2013, at 12:45 AM, Dru Kepple <drukepple at gmail.com> wrote:
> I've got a shell script that I tried to make a little more readable with ANSI color. It works when I run it from the command line, but when I have it open in TM2 (and 1) and press Cmd-R, the script executes but I get no color.
Escape codes for colors is a “terminal” feature, meaning that only scripts running in a terminal should use such escape codes. TextMate does not offer a terminal environment when running scripts.
It’s something we’re keen to provide, but so far have not gotten around to do.
Ideally you would make your script only do styled output if it runs in a terminal, e.g. you may also pipe the output of your script into a (log) file or another program (like grep or mate), in which case you do not want the escape codes.
That said, it’s fairly easy to make the script runner for shell scripts match ANSI styles and output the proper HTML tags (but as majority of scripts disable colored output when not running in a terminal, very few scripts would actually benefit from this).
More information about the textmate