rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Gerry.Tomlinson@newcastle.ac.uk
To: rc@hawkwind.utcs.toronto.edu
Subject: Re: -s flag
Date: Wed, 1 Jul 1992 08:52:48 -0400	[thread overview]
Message-ID: <AA03485.9207011252.bygate@uk.ac.newcastle> (raw)
In-Reply-To: <9206301529.AA11747@utopia.adobe.com>; from "haahr@com.adobe" at Jun 30, 92 4:42 pm

> 
> > It's a lot better to fix Jove than to 'fix' rc.  You could do this like
> > vi/ex does it.  If I execute a subshell command in vi, then any % is
> > replaced by the current filename, ie
> > 	:!mv % %.bak
> > would be expanded to
> > 	:!mv foo foo.bak
> > etc.  This is a lot better than hacking a kludge into rc for the sake of
> > one editor.
> 
> i disagree vehemently.  shell variable subsitution is a much better defined
> mechanism than vi's subtituting for %.  (e.g., how do you quote %?  what if
> you invoked vi without a filename?)  in general, i take issue with any
> program blindly editing input that the user has typed for another program,
> even if that other program is a shell.
> 
> now, one could make the argument that the file should be stored in an
> environment variable, e.g. $file, and if every editor were coerced to
> use rc's notion of control-a separated lists, that would even work for
> multiple files.  but $n is a logical place to put the file names, and
> has no other conventional meaning for subshells invoked from editors.
> 

I've been thinking how to reference filenames from  shell escapes in my
X file display program xp (export.lcs.mit.edu:contrib/xp-1.1.tar.Z). I
originally adopted the vi % mechanism, simply  using system or popen to
execute the command after expanding any %'s, however I was never very
happy with this 'cos of the quoting problem & the lack of
generalisation. My development version does its own "system" thereby
respecting $SHELL so I can use all my rc functions. If instead I execed
$SHELL -s with the command line as stdin, with the filenames as the
arguments, and set the environment variable i to be that of the current
file, then one could reference all files with $*, numbered files with $n,
and the current file with $i, without xp having to touch the user's
input. Much nicer I think.

Until this discussion started I wasn't even aware of the -s option.
When did it first appear? I have a V8 manual to hand and it's
in there - does anyone know if it's in Tom Duff's rc?

	Gerry.

Gerry.Tomlinson@newcastle.ac.uk
Computing Laboratory, The University, Newcastle upon Tyne, UK, NE1 7RU
Tel: +44 091 222 8139




  reply	other threads:[~1992-07-01 13:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-06-30 15:29 haahr
1992-07-01 12:52 ` Gerry.Tomlinson [this message]
1992-07-01 21:14   ` Chris Siebenmann
  -- strict thread matches above, loose matches on Subject: below --
1992-07-02 14:03 Chet Ramey
1992-07-01 21:30 "D. Hugh Redelmeier"
1992-07-02 12:52 ` Gerry.Tomlinson
1992-06-30 15:03 "D. Hugh Redelmeier"
1992-06-30  6:55 "D. Hugh Redelmeier"
1992-06-30  8:26 ` Matthew Farwell

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=AA03485.9207011252.bygate@uk.ac.newcastle \
    --to=gerry.tomlinson@newcastle.ac.uk \
    --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).