Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

using \r in a while statement



I have a script which takes a usenet message id as an argument
and then downloads the message and sends it to a pager.
My current problem is testing for the end of the news article.
I'm using a while loop to read in the article a line at a time.
The article is ended by a line which only has .\r\n on it, so
the while statment looks a bit like:

while [[ $LINE != ".\r" ]]; do
    readline
    printline
done

Unfortunately this doesn't work.
I found if I used ^Q^M in emacs I could insert the actual code in
place of the \r and this works, but it means that if someone looks
at my code on my web page then it looks all strange and I'm sure
that it won't download properly.

I've ended up with:
while [[ $LINE != `echo ".\r"` ]]; do
    readline
    printline
done

which works, but I was wondering if anyone could think of a better
way of doing it?

Thanks...
-- 
Alan Third



Messages sorted by: Reverse Date, Date, Thread, Author