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 c...@case.edu http://cnswww.cns.cwru.edu/~chet/