Version française
Home     About     Download     Resources     Contact us    
Browse thread
color on linux terminal
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] color on linux terminal
On Sat, Jan 13, 2007 at 08:29:16PM +0000, Markus Weihs wrote:
> to get coloured output on a linux terminal, you can do something like
> 
>     echo -e "\033[31m This is now red"
> 
> How can I do this with OCaml? The following doesn't work
> 
>     print_string "\033[31m blabla"

This is my biggest "pet peeve" about OCaml.  It uses *decimal* escapes
for characters, not octal like everywhere else in the UNIX and
C-influenced universe.

So you want
     print_string "\027[31m blabla"

-- 
Eric Cooper             e c c @ c m u . e d u