rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: gjv%atlas%cesar@crbca1.SINet.SLB.COM
To: rc%hawkwind.utcs.toronto.edu%m_internet%m_mailnow%hermes.DECnet@cesar.
Subject: Re: A patch to add builtin read (small bug)
Date: Thu, 23 Sep 1993 03:30:58 -0400	[thread overview]
Message-ID: <9309230734.AA19392@SINet.SLB.COM> (raw)
In-Reply-To: Your message of "Tue, 21 Sep 1993 23:11:29 +0200."

 |                 The diffs assume you've been keeping up with the bug
 |fix patches posted here.  (If anyone wants a complete set of diffs
 |against a virgin copy of 1.4 let me know and I'll mail it to you.)

The patch dropped in nicely in my virgin 1.4, no problems.

I was just wondering about the following case:

	; x=(foo bar)
	; read x < /dev/null
	; echo $status
	; whatis x
	x=(foo bar)

This suggests that something has been read before encountering EOF,
which is obviously not the case, so I assume the read should set x to ''.

  |For Chris, if you don't care about setting a different ifs, you can
  |split the line without a fork by using eval:
  |	read x;eval 'x=('$x')'

This doesn't work:

	; read x;eval 'x=('$x')'
	a line with a # in the middle
	line 1: syntax error near eof

	; read x;eval 'x=('$x')'
	a line with a = in the middle
	line 1: syntax error near '='

The 'trick' with the echo works however, fork()-ing every time:

	; read x; x= `{echo $x}
	a line with a # in the middle
	; whatis x
	x=(a line with a '#' in the middle)

If a read function is added, why not make it a bit more practical by using
$ifs? If makes it more useful, and the code above a bit more elegant.
I wouldn't mind adding this myself, but I'm not too familiar with the
rc internals.


J.G. Vons   E-Mail: vons@cesar.crbca1.sinet.slb.com

             reply	other threads:[~1993-09-23  7:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-23  7:30 gjv%atlas%cesar [this message]
1993-09-23 15:19 Tom Culliton x2278
1993-09-23 15:36 Arnold Robbins
1993-09-23 16:03 gjv%atlas%cesar
1993-09-23 18:10 Tom Culliton x2278

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:

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

  git send-email \
    --in-reply-to=9309230734.AA19392@SINet.SLB.COM \
    --to=gjv%atlas%cesar@crbca1.sinet.slb.com \
    --cc=rc%hawkwind.utcs.toronto.edu%m_internet%m_mailnow%hermes.DECnet@cesar.sedalia.sinet.slb.com \
    --cc=vons@cesar.crbca1.sinet.slb.com \


* 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.
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).