zsh-users
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: zsh-users@sunsite.auc.dk
Subject: using \r in a while statement
Date: Sat, 23 Sep 2000 01:41:52 +0100	[thread overview]
Message-ID: <20000923014152.A2045@idiocy.org> (raw)

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


             reply	other threads:[~2000-09-23  0:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-23  0:41 Alan Third [this message]
2000-09-23  6:11 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000923014152.A2045@idiocy.org \
    --to=alan@idiocy.org \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).