[Top][All Lists]

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

Re: Problem:bash_builtin:mapfile:option_C:executing_indxed_array_value:b

From: Chet Ramey
Subject: Re: Problem:bash_builtin:mapfile:option_C:executing_indxed_array_value:better_english_and_more_info
Date: Wed, 03 Aug 2011 17:52:58 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11

On 7/31/11 10:24 AM, Bruxo Pi wrote:

> Bash Version: 4.2
> Patch Level: 8
> Release Status: release
> Description:
> Bash bultin 'mapfile', with -C option, executes any value read from stdin. 
> The usage - from bash_ref.pdf - is:
> mapfile [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c 
> quantum] [array]
> My command:
> $ mapfile -t -n 4 -c 2 -C let _par++ _vet
> Well, when it reads the second and fourth entries, from stdin, and IF the 
> entry is equal to or contains 'ç' or 'Ç', it complains, eath 2 line (normal), 
> with the erro message (not normal):
> ./test.sh: linha 8: let: Ç: erro de sintaxe: operando esperado (token com 
> erro é "Ç")
> [translated: $0: line 8: let: Ç: syntax error: expected operand (error token 
> with "Ç")]

The manual page says:

        When callback is evaluated, it is supplied the index of the next
        array element to be assigned and the line to be assigned to that
        element  as  additional  arguments.  callback is evaluated after
        the line is read but before the array element is assigned.

Whatever command you specify is executed with these (possibly many,
depending on how the contents of the line get split) additional arguments.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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