[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with array element assignment
From: |
homac |
Subject: |
Problem with array element assignment |
Date: |
Sun, 15 Apr 2007 21:59:11 +0200 |
User-agent: |
Icedove 1.5.0.10 (X11/20070307) |
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
- Problem with array element assignment,
homac <=