zsh-users
 help / color / mirror / code / Atom feed
* using \r in a while statement
@ 2000-09-23  0:41 Alan Third
  2000-09-23  6:11 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Third @ 2000-09-23  0:41 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-09-23  6:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-23  0:41 using \r in a while statement Alan Third
2000-09-23  6:11 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).