Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

end of file

Status
Not open for further replies.

Yarka

Technical User
Jan 14, 2007
192
ES
i've script as:

cat $1 | while read LINE; do
until [ "$a" -eq 1 ]; do
...
read LINE
...
done

read LINE

until [ "$b" -eq 1 ]; do
...
read LINE
...
read LINE
...
done
done

how i can indicate end of file in the conditions of until?


thanks.
 
Something along the lines of
Code:
until ! read line
do
  until [ $a -eq 1 ]
  do
    ...
  done
  until [ $b -eq 1 ]
  do
    ...
  done
done < $1


Ceci n'est pas une signature
Columb Healy
 
Hmm

I think I see what you mean this time
In pseudo code
Code:
while more file to read
do
  ...
  until $a equals 1 OR end of file
  do
    ...
  done
  until $b equals 1 OR end of file
  do
    ...
  done
  ...
done
How about
Code:
while read line
do
  ...
  while read line
  do
    ...
    ...
    [[ $a -eq 1 ]] && break
  done
  while read line
  do
    ...
    ...
    [[ $b -eq 1 ]] && break
  done
  ...
done
There will still be some issues at the boundaries which you will have to watch closely but

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top