[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] read -ep and ANSI colour sequences

From: muji
Subject: Re: [Help-bash] read -ep and ANSI colour sequences
Date: Wed, 20 Feb 2013 15:19:47 +0100

Thanks for the feedback Greg. I respect your opinion as I've learnt a
lot from your FAQ and your posts on the lists. Although, I do not
think that writing a C program when bash does *nearly* everything I
need is necessary, it feels like reinventing the wheel.

To be clear, I am not trying to write a shell, I am trying to write an
interactive shell program to capture user-input and create a file
based on the user-input. I think this is quite a common use case for

With regard to your point about terminfo/termcap I can inspect $TERM
and omit the ANSI sequences for the terminals that do not support the
ANSI sequences I am using. This is not complex to implement.

2013/2/20 Greg Wooledge <address@hidden>:
> On Wed, Feb 20, 2013 at 02:06:41PM +0100, muji wrote:
>> The use case is an interactive shell program. FYI, I am using bash-4.2.
> Stop trying to write a shell in shell script.  It's ludicrous.  Bash
> is simply not a powerful enough language for this job.
> If you need the kind of direct control over the terminal that you
> claim you need, then you should be writing in C with a curses library
> (or slang, or whatever people use for terminal control these days).
> You can link in the readline library if you want, though I don't know
> how well readline interacts with curses/slang/whatever you are using
> to send color codes and keep track of the position of the cursor.  You
> may even have to write your own readline replacement for this job.
> Or, the simpler approach would be to re-specify the problem so that you
> do not need color escape sequences in your prompts.
> And whatever you do, STOP hard-coding terminal-specific escape sequences.
> This will cease working when you run it on a terminal that uses different
> escape sequences.  This is why we have termcap/terminfo libraries and
> a $TERM variable.

mischa (aka muji).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]