Re: [PATCH] \e in "echo" and "printf" builtins

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

 



Adam Borowski <kilobyte@xxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux