![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| reading more than one variable into a for loop | starsky | UNIX for Dummies Questions & Answers | 3 | 10-24-2008 01:01 PM |
| reading from 2 files through while loop | windows | Shell Programming and Scripting | 2 | 08-22-2008 11:17 AM |
| Reading from while loop into an array | ssuresh1999 | UNIX for Dummies Questions & Answers | 2 | 08-12-2008 12:53 PM |
| Reading from a specific line in a loop | kaushikraman | Shell Programming and Scripting | 3 | 07-24-2008 06:49 AM |
| reading from within the loop --std i/p problem | mobydick | Shell Programming and Scripting | 2 | 07-11-2008 09:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
while loop not reading last line
hi all,
i have a while loop which i am using to read lines into an array: Code:
k=0
exec 10<file
while read LINE <&10; do
ARRAY[$k]=$LINE
((k++))
done
exec 10>&-
echo ${ARRAY[@]}
any help appreciated. Last edited by Franklin52; 12-09-2008 at 10:12 AM.. Reason: adding correct code tags |
|
||||
|
Quote:
The first problem is this line: Code:
exec 10<file The second problem is this: Code:
((k++)) Code:
k=0
exec 4<file
while read LINE <&4; do
ARRAY[$k]=$LINE
(( k+=1 ))
done
exec 4<&-
echo ${ARRAY[@]}
bakunin |
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|