Hello,

i experienced a problem with array element assignment.

The following script should read a text file and assign every line
beginning with the symbol '?' to the array U.


The script:
----------------
i=0
cat test.txt | while read s l ; do
        case $s in
                ( '?' )  U[i]=$l ; ((i++)) ;;
        esac
done
echo ${#U[*]}
----------------

Content of the input file 'test.txt':
----------------
? fragezeichen1
? fragezeichen2
? fragezeichen3
A alpha1
A alpha2
B beta1
? fragezeichen4
A alpha3
----------------

Output of the script (number of elements in array U):
----------------
0
----------------


Greetings
 Homac


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to