Discussion: printf '\e'
Afficher un message
Vieux 25/03/2008, 15h49   #3
Stephane CHAZELAS
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: printf '\e'

2008-03-25, 04:39(-07), Spiros Bousbouras:
> I noticed that the BASH and Korn printf
> built-ins output ESC with printf '\e' but
> the DAsh printf outputs the actual characters.
>
> With printf '%b' '\e' BASH outputs ESC, while
> Korn and DAsh output the characters.
>
> I had a look into POSIX. I'm not sure I've
> managed to locate all the relevant sections
> but those I've read do not mention \e as an
> escape sequence which means that using it is
> unspecified behaviour. If I'm right then
> which are the allowed behaviours ?


Only '\a', '\b', '\f', '\n', '\r', '\t', '\v' are standard.

printf '\33'
printf '\033'

printf %b '\033'
printf %b '\0033'

are also OK.

printf %b '\33'
is unspecified I think.

printf '\0033' | cat -v
is meant to output '^C3'

but YMMV.

--
Stéphane
  Réponse avec citation
 
Page generated in 0,06726 seconds with 9 queries