rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Byron Rakitzis <byron>
To: rc
Subject: Re:  status of `{} commands
Date: Fri, 27 Sep 1991 23:43:20 -0500	[thread overview]
Message-ID: <91Sep27.234330cdt.19036@archone.tamu.edu> (raw)

Unfortunately, `{} is not a command, it is a construct that exapands to a list.
Let's leave it that way.

The only time I can see you being interested in the exit status of a command
in backquotes is when assigning variables, otherwise the very meaning of
$status becomes distorted. i.e.,

	echo `{/bin/false}

should set status to true, in my opinion. Allowing ` to set $status would
clutter the semantics of `, imho.

I'm not sure what to do in the case of assignments. Would it not be possible
to write a function which takes a command and a variable name as arguments
and performs the assignment while overriding $status?

e.g.,

	fn assigncc {
		tmp = `` $nl {eval $2; echo $status}
		if (~ $#tmp 2 && ~ $tmp(2) 0) {
			$1 = `{echo $tmp(1)}
		} else {
			return 1
		}
	}

to be used as

	assigncc foo 'echo hi'

I will agree that this option would be more feasible if you could pass
pieces of rc code as arguments. The eval and the quoting of the command
to be executed is definitely problematic.


             reply	other threads:[~1991-09-28  4:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-09-28  4:43 Byron Rakitzis [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-09-28  3:24 Chris Siebenmann

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=91Sep27.234330cdt.19036@archone.tamu.edu \
    --to=rc@hawkwind.utcs.toronto.edu \
    /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.
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).