From: Alan Watson <alan@oldp.astro.wisc.edu>
To: rc@hawkwind.utcs.toronto.edu
Subject: A delicious thought
Date: Tue, 18 May 1993 13:01:04 -0400 [thread overview]
Message-ID: <9305181701.AA22461@oldp.astro.wisc.edu> (raw)
rc keeps everything in the environment (other than its flags and at
least until noexport arrives), so there is almost no need for any
built-in commands whatsoever: simply, exec a command which performs the
`built-in' and then have that command exec another rc, e.g.:
; fn cd { exec not-built-in-cd $* }
; cat `{ whatis not-built-in-cd }
#! /bin/sh
cd ${1+$"$@"}
exec rc
;
Flags like `-x' don't get carried over, but otherwise this seems like a
complete functional replacement of cd (and, likewise, limit, wait, and
umask). Of course, if you really wanted to do this, you'd probably code
up the not-built-ins in C.
All of this is somewhat academic, but if someone DID want to add a new
built-in (or, rather, something which had to function in the same
process as rc), this would be an obvious solution. To me, this is a
strong argument in favour of placing the flags in the environment (or,
at least, what they can be read into the environment) and against
noexport (or, at least, against a no export which cannot be easily and
temporarily over-ridden).
Once again, rc's clean design and the original philosophy of putting
everything into the environment seems to be paying off dividends.
Alan.
P.S. A free email message to the first person to publicly claim that
they really do want to exec twice just to change directory (limit is a
more obvious candidate to go to a not-built-in implementation --
wouldn't you like to get one more piece of #ifdef-ed code out of the
source?).
next reply other threads:[~1993-05-18 17:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-05-18 17:01 Alan Watson [this message]
1993-05-18 19:39 ` root
1993-05-18 17:08 Arnold Robbins
1993-05-18 17:10 Byron Rakitzis
1993-05-18 18:19 Alan Watson
1993-05-19 10:00 ` Richard Brooksby
1993-05-19 14:04 Alan Watson
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=9305181701.AA22461@oldp.astro.wisc.edu \
--to=alan@oldp.astro.wisc.edu \
--cc=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).