Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: command substitution with control chars?
- X-seq: zsh-users 11339
- From: Micah Cowan <micah@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: command substitution with control chars?
- Date: Sun, 25 Mar 2007 12:50:28 -0700
- In-reply-to: <20070325185204.48021.qmail@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070325094407.62594.qmail@xxxxxxxxxxx> <237967ef0703251133y79cde28coaa7a788f0ced8069@xxxxxxxxxxxxxx> <20070325185204.48021.qmail@xxxxxxxxxxx>
Atom Smasher wrote:
> On Sun, 25 Mar 2007, Mikael Magnusson wrote:
>
>> It sounds like you just need to put your escape sequences inside %{ %}
>> pairs?
> =====================
>
> then i wind up getting colored "%{" and colored "%}" in the prompt, and
> things are still hosed. maybe there's a way to do it, but i haven't
> figured it out yet...
>
> basically, i'm taking this idea <http://swicked.net/pages/bat_mon.html>
> and trying to convert it from linux to bsd and from bash to zsh. i've
> got a script that outputs battery status, and uses different colors to
> display the output depending on the status... now to get the output into
> my prompt...
>
> anyway, it seems that if the output of the script includes the zsh
> escape sequences it doesn't work as expected.
If you are getting colored "%{" and "%}" in your prompt, then you
probably just need to make sure that the prompt_percent option is set.
I started a thread a couple weeks ago about a shell-script I was working
on that does an abbreviated suspended-jobs-list on the command-line,
which has similar issues to your own (except that, I'm also keeping the
whole script compatible with bash and ksh as well). Bash uses "\[" and
"\]" (without requiring an option to be set); and ksh uses... an
abomination that involves carefully selecting a control character that
doesn't print anything on any terminal you wish to support. :)
--
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author