[plug] function error

Jon Miller jlmiller at mmtnetworks.com.au
Wed Jan 11 21:50:21 WST 2006


I'm trying to get this function to work , what I need is for it to read the contents of a file and print it to screen 1 line at a time.
The username2.txt file consists of a names 1 per line.  I just need to to increment 1 name at a time which if I understand the while statement while line1 is less than 10 it should keep reading and increment by 1.  Is the incrementing a built-in feature of bash while loop.  If I'm right in C or C++ you had to have to use something like "line +1" or " ++line1"

#!/bin/bash
# Reading lines in /etc/fstab.
File=username2.txt
function test {
while [ "line1" < 10 ]; do
{
read line1
} < $File

done

echo "First line in $File is:"
echo "$line1"
echo
exit 0
}
test();





More information about the plug mailing list