Re: printf '\e'
2008-03-25, 07:07(-07), Spiros Bousbouras:
> On 25 Mar, 14:03, Stephane CHAZELAS <this.addr...@is.invalid> wrote:
>> 2008-03-25, 06:53(-07), Spiros Bousbouras:
>> [...]
>>
>> >> Only '\a', '\b', '\f', '\n', '\r', '\t', '\v' are standard.
>>
>> > That's what I thought but can an implementation
>> > output anything it wants with \e or is there a collection
>> > of permitted behaviours ?
>>
>> \e is unspecified. If you want to output \e as opposed to the
>> ESC character, use printf '\\e' or printf %s '\e'
>
> What does unspecified mean in POSIX ? In the C standard
> it means that the standard specifies a list of behaviours
> and the implementation can choose any one of them without
> needing to document it.
That means that if your shell script has:
printf '\e'
you don't know what you'll get, that can be anything, so you
should not use it in a POSIX script that intents to be portable.
And if you're implementing a new "printf" utility, you can do
whatever you want in that case as POSIX doesn't specify the
behavior. So you can issue an error message, you can launch a
web browser, shutdown the machine, output an ESC character,
output an ASCII EOT, ETB, ETX... character, output \e, turn on
terminal echo, erase a character...
--
Stéphane
|