rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Stefan Dalibor <dalibor@immd3.informatik.uni-erlangen.de>
To: rc-owner
Subject: Question about input redirection in -c
Date: Fri, 13 Aug 1993 11:47:34 -0400	[thread overview]
Message-ID: <9308131547.AA03866@faui33.informatik.uni-erlangen.de> (raw)


Hi,

from the manpage:

  -c   If -c  is  present,  commands  are  executed  from  the
       immediately  following argument.  Any further arguments
       to rc are placed in $*.

and:

  exec [arg ...]
       Replaces rc with the given command.  If the  exec  con-
       tains  only redirections, then these redirections apply
       to the current shell and the shell does not exit.   For
       example,

            exec >[2] err.out

       places further output to standard  error  in  the  file
       err.out.

this made me think

  rc -c 'pwd; . /dev/tty'

would have the same effect as 

  rc -c 'pwd; exec </dev/tty'

But it has not - the first command behaves as expected (execute pwd,
then read from the terminal), the second executes pwd, but the input
redirection is ignored and rc exits.
Browsing through the source code revealed that the redirection *is*
done (doredirs() is called in exec()), but is ignored in doit() after
returning from walk() - the EOF the lexer got from parsing the
argument string `overrides' the input redirection because no pushfd()
is performed. 

A comment in doit() (`` "last" can be clobbered during a walk() '')
and comparisons with other shells indicate that rc does this on 
purpose - but I can't see the reason for it. For me it's puzzling that
`exec</dev/tty' changes its meaning when executed via `rc -c', so
could some kind soul please explain it?

Bye,
Stefan

--                                                                  --
Stefan Dalibor                dalibor@immd3.informatik.uni-erlangen.de


             reply	other threads:[~1993-08-13 20:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-08-13 15:47 Stefan Dalibor [this message]
1993-08-13 21:17 Byron Rakitzis
1993-08-18  7:47 Stefan Dalibor

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=9308131547.AA03866@faui33.informatik.uni-erlangen.de \
    --to=dalibor@immd3.informatik.uni-erlangen.de \
    /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).