bug-bash
[Top][All Lists]
Advanced

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

Re: qwerty


From: Ken Irving
Subject: Re: qwerty
Date: Wed, 11 Nov 2009 16:10:15 -0900
User-agent: Mutt/1.5.18 (2008-05-17)

On Thu, Nov 12, 2009 at 01:47:52AM +0100, Antonio Macchi wrote:
> $ printf "%s\n" ok -
> ok
> -
>
> why that score in the newline?

Your pattern has one format operator, but there are two arguments,
so the pattern is applied again.

> --------
>
> $ printf "%d %s\n" 1 ok -
> 1 ok
> -bash: printf: -: invalid number
> 0
>
> why getting error here, and not in the previous?
> why "invalid number" ?
> what is that zero?

Again, you have more arguments than operators, so it makes another pass,
and on the second pass tries to format - as a number...  Don't know
about the zero, but I guess %d maybe starts with a default of 0...?

> --------
>
> $ printf "%2s\n" qwerty
> qwerty
>
> strings larger than fixed-width are entire written?

It's not fixed width but minimum width.


> I'm using BASH_VERSION 3.2.39, so please forgive me if this issue are  
> already fixed


There's nothing to fix.  It might help if you provide some markers
in your test patterns so you can see where each argument begins and
ends, e.g.,

    $ printf "(%d) {%s}\n" 1 ok -
    (1) {ok}
    -bash: printf: -: invalid number
    (0) {}
    
Ken

-- 
Ken Irving, fnkci@uaf.edu, 907-474-6152
Water and Environmental Research Center
Institute of Northern Engineering
University of Alaska, Fairbanks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]