Linux-Dash Archive mirror
 help / color / mirror / Atom feed
From: jca+dash@wxcvbn.org (Jérémie Courrèges-Anglas)
To: Adam Borowski <kilobyte@angband.pl>
Cc: dash@vger.kernel.org
Subject: Re: [PATCH] \e in "echo" and "printf" builtins
Date: Wed, 23 Jul 2014 12:26:05 +0200	[thread overview]
Message-ID: <87fvhstlqa.fsf@ritchie.wxcvbn.org> (raw)
In-Reply-To: <20140723091117.GA30150@angband.pl> (Adam Borowski's message of "Wed, 23 Jul 2014 11:11:17 +0200")

Adam Borowski <kilobyte@angband.pl> writes:

> On Sat, Jun 28, 2014 at 07:27:22PM +0200, Adam Borowski wrote:
>> On Sat, Jun 28, 2014 at 06:52:51PM +0200, Harald van Dijk wrote:
>> > On 28/06/14 06:56, Adam Borowski wrote:
>> > > I'm not sure what's your policy towards extensions, but \e as \033 is
>> > > something ubiquitous in the Unix world.  C compilers (gcc, clang, icc and
>> > > tcc -- but not MSVC), perl, shells (bash and zsh -- but not dash), etc.
>> > 
>> > No comment on whether dash itself should accept \e, but [...]
>
> So... can I has an answer whether dash should indeed accept \e ?
> Being told "no" or "go away, we hate you" is fine, I just dislike having
> patches rot forever.  And not having this shorthand is annoying if you
> like using colour for highlights -- it works in perl and bash, then
> suddenly Oops! not in /bin/sh = dash.

I agree with Erik Blake, IMO there is no reason for dash to support \e
unless POSIX standardizes it first.  Except if you want to encourage
unportable scripts, of course.  /bin/sh is not necessarily bash or dash.

$ /bin/sh
$ type echo
echo is a shell builtin
$ echo '\033[1m hello \033[0m'
 hello # (bold)
$ /bin/echo '\033[1m hello \033[0m'
\033[1m hello \033[0m
$ echo '\e[1m hello \e[0m'
\e[1m hello \e[0m
$ /bin/echo  '\e[1m hello \e[0m'
\e[1m hello \e[0m
$

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

  reply	other threads:[~2014-07-23 10:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-28  4:56 [PATCH] \e in "echo" and "printf" builtins Adam Borowski
2014-06-28 16:52 ` Harald van Dijk
2014-06-28 17:27   ` Adam Borowski
2014-07-23  9:11     ` Adam Borowski
2014-07-23 10:26       ` Jérémie Courrèges-Anglas [this message]
2014-06-28 17:33   ` Paul Gilmartin
2014-06-29  9:28     ` Harald van Dijk
2014-06-30 13:08     ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvhstlqa.fsf@ritchie.wxcvbn.org \
    --to=jca+dash@wxcvbn.org \
    --cc=dash@vger.kernel.org \
    --cc=kilobyte@angband.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).