From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from SINet.SLB.COM ([163.185.18.1]) by hawkwind.utcs.toronto.edu with SMTP id <2664>; Tue, 21 Sep 1993 12:53:45 -0400 Received: from snmrtr.psi by SINet.SLB.COM id AA00816; Tue, 21 Sep 93 16:56:19 GMT From: gjv%atlas%cesar@crbca1.SINet.SLB.COM Message-Id: <9309211656.AA00816@SINet.SLB.COM> Apparently-To: "hawkwind.utcs.toronto.edu::rc" X-Vms-From: PSI%CRBCA1::CESAR::ATLAS::"gjv" X-Vms-To: HERMES::M_MAILNOW::M_INTERNET::HAWKWIND.UTCS.TORONTO.EDU::RC Received: by DniMail (v1.0); Tue Sep 21 18:52:02 1993 MET DST Received: from pyxis by atlas.atlasnis (4.1/SMI-4.1-DNI) id AA13907; Tue, 21 Sep 93 18:51:45 +0200 To: rc%hawkwind.utcs.toronto.edu%m_internet%m_mailnow%hermes.DECnet@cesar. sedalia.sinet.slb.com Subject: Re: Thoughts on a builtin read In-Reply-To: Your message of "Tue, 21 Sep 1993 17:57:14 +0200." Reply-To: vons@cesar.crbca1.sinet.slb.com Date: Tue, 21 Sep 1993 12:52:34 -0400 [Malte wrote:] |[ rsalz@osf.org wrote ]: | set $status to? Leave it unchanged? What about | x=* | if the directory is empty? And if it isn't? What about This sets x to '*', no error whatsoever. | x=/foo/* | when /foo doesn't exist? This sets x to '/foo/*', again no error. |Yes, an assignment leaves the status unchanged. Your file name expansion |examples are just a shorthand for | x = `{ glob /foo/* } # glob == echo I agree on this, It would be nice if the status reflects the result of the evaluation of the right-hand side, not that of the assignment itself. If you 'redefine' $status this way, it is also possible to save and restore its value, something you currently can't (see my earlier mail on the problems with $status and the prompt function). The only problem here may be the following: ; a=(b c) ; $a="foo" multi-word variable name ; echo $status 1 However, an rc-script aborts if you try this, so you can't check $status anyway. |There's been a discussion on shift shifting arbitrary lists with the |proposed syntax being "shift x 2" probably because "x = `{ shift x 2 }" |isn't too elegant. If this makes its way into rc, I don't mind if read |expects a variable as a command line parameter. As Chris said, a `BUILTIN currently always forks, which is a disadvantage of an implementation like "x=`{shift x 2}" or "x=`{read a; echo $a}" in order to get a set of words in 'x'. And since the $$ construction already allows a function like 'append x (a b c)' in order to modify the variable 'x', a 'read x' or 'shift x 2' is not introducing something new. Personally, I think that s = shift 2 $s s = shift 2 (what ever list) l = read l2 = read [1=3] # would this read from descriptor 3 ? would also be quite elegant, avoiding the builtins taking variable names. But as mentioned above, this causes problems with the current implementation of $status. Gert-Jan --------------------------------------------------- J.G. Vons E-Mail: vons@cesar.crbca1.sinet.slb.com