Re: Undocumented usage of printf?
On 4/15/10 10:21 AM, Clark J. Wang wrote: I saw a printf usage from a Linux forum's post: # printf %d\n 'a 97 # It's really cool but I found no info in bash's manual. Are there any other undocumented interesting features? :) They're in Posix. Thanks for pointing out the omission; I will add descriptions for the next release of bash. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Undocumented usage of printf?
Clark J. Wang schrieb: I saw a printf usage from a Linux forum's post: # printf %d\n 'a 97 # It's really cool but I found no info in bash's manual. Are there any other undocumented interesting features? :) I documented it, though I don't remember where I first heard about it. Maybe I stumbled over it in POSIX (it's specified there). http://bash-hackers.org/wiki/doku.php/commands/builtin/printf#arguments Jan
Re: Undocumented usage of printf?
On Thu, Apr 15, 2010 at 11:43 PM, Eric Blake ebl...@redhat.com wrote: On 04/15/2010 08:21 AM, Clark J. Wang wrote: I saw a printf usage from a Linux forum's post: # printf %d\n 'a 97 # POSIX requires this behavior, so you could claim that this serves as documentation: http://www.opengroup.org/onlinepubs/9699919799/utilities/printf.html If the leading character is a single-quote or double-quote, the value shall be the numeric value in the underlying codeset of the character following the single-quote or double-quote. Thank you. I've never read the POSIX standards so carefully. :) -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org