On Tue, Jul 10, 2007 at 09:35:56PM -0400, Chet Ramey wrote: > Poor Yorick wrote: > > (on my debian system, bashbug reports for bash 2.05) > > > > printf status is 0 but /usr/bin/printf is 1. Is this the expected behavior? > > > > [EMAIL PROTECTED]:~$ bash3 > > [EMAIL PROTECTED]:~$ bash3 --version > > GNU bash, version 3.00.16(1)-release (i386-pc-linux-gnu) > > Copyright (C) 2004 Free Software Foundation, Inc. > > [EMAIL PROTECTED]:~$ printf '\x' > > bash3: printf: missing hex digit for \x > > [EMAIL PROTECTED]:~$ echo $? > > 0 > > Bash treats unrecognized backslash escapes as characters to be printed > and does not consider them an error. \x without any hex digits doesn't > have any special meaning, though, since it's probably not what's > intended, bash prints a warning. [...]
Note that both AT&T ksh and zsh output a NUL byte and return success there. pdksh derivatives (pdksh, mksh, posh) output an error message and return 1. ash derivatives output "\x" and return success. The behavior of printf upon \x is /unspecified/ as per POSIX, so all the behaviors observed are valid. A portable application shouldn't use printf '\x<whatever>'. The octal representation (\o, \oo or \ooo) is standard. -- Stéphane _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash