[plug] function error

Mr E_T troll at arach.net.au
Wed Jan 11 21:56:25 WST 2006


On Wednesday 11 January 2006 21:48, Mr E_T wrote:
> On Wednesday 11 January 2006 21:50, Jon Miller wrote:
> > 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"
> > 
> I assume that you want the line to be greater than 10 chars 
> 
> > #!/bin/bash
> > # Reading lines in /etc/fstab.
> > File=username2.txt
> line1=""
> > function test {
> while read LN
>   do
>     if [ "${#line1}" < 10 ]
doh!
    if [ "${#line1}" -lt 10 ]

>       then
>         line1="$LN"
>       fi
>   done
> > } < $File
> > 
> > done
> > 
> > echo "First line in $File is:"
> > echo "$line1"
> > echo
> > exit 0
> > }
> > test();
> 
> 
> 

-- 
regs MR E_T
_______________________
\                      \
  \   OOHH I hate TYPOS  \
    \                      \
      ~~~~~~~~~~~~~~~~~~~~~~~



More information about the plug mailing list