rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* bug?
@ 2001-05-28  8:47 Russell Davies
  2001-05-28 10:55 ` bug? Carlo Strozzi
  2001-05-28 15:20 ` bug? Paul Haahr
  0 siblings, 2 replies; 4+ messages in thread
From: Russell Davies @ 2001-05-28  8:47 UTC (permalink / raw)
  To: rc


; mkdir $HOME/e
; cdpath=$HOME
; cd /
; cd e
/home/blah/e

ok, all is well. Suppose now I want to suppress the output of the cd e.

; cd /
; cd e >/dev/null
; pwd
/

huh? I haven't had time to dig too deeply but if someone else has looked
at it before, I won't bother.

r.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug?
  2001-05-28  8:47 bug? Russell Davies
@ 2001-05-28 10:55 ` Carlo Strozzi
  2001-05-28 15:20 ` bug? Paul Haahr
  1 sibling, 0 replies; 4+ messages in thread
From: Carlo Strozzi @ 2001-05-28 10:55 UTC (permalink / raw)
  To: rc

On Mon, May 28, 2001 at 03:47:00AM -0500, Russell Davies wrote:
| 
| ; mkdir $HOME/e
| ; cdpath=$HOME
| ; cd /
| ; cd e
| /home/blah/e
| 
| ok, all is well. Suppose now I want to suppress the output of the cd e.
| 
| ; cd /
| ; cd e >/dev/null
| ; pwd
| /

I believe the '>' redirection causes cd to be executed in a subshell,
and when the latter dies so does the cd effect.

bye,
carlo
-- 
Carlo Strozzi
TeXne.COM - Open Consulting
Mail: carlos@texne.com  Voice: (+39)0523-883732  Fax: (+39)0523-840980


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug?
  2001-05-28  8:47 bug? Russell Davies
  2001-05-28 10:55 ` bug? Carlo Strozzi
@ 2001-05-28 15:20 ` Paul Haahr
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Haahr @ 2001-05-28 15:20 UTC (permalink / raw)
  To: Russell Davies; +Cc: rc

--- Russell Davies <russell.davies@db.com> wrote:
> 
> ; mkdir $HOME/e
> ; cdpath=$HOME
> ; cd /
> ; cd e
> /home/blah/e
> 
> ok, all is well. Suppose now I want to suppress the output of the cd
> e.
> 
> ; cd /
> ; cd e >/dev/null
> ; pwd
> /
> 
> huh? I haven't had time to dig too deeply but if someone else has
> looked at it before, I won't bother.

I don't have a Unix box in front of me to test or access to the source, but
rc commands with redirected I/O run in subshells;  thus, the directory of
your child process is changed, but not the parent process.

(I think we fixed that in es by remapping file descriptors all over the
place and forking way late in the game.)

--p

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug?
@ 2001-05-28 17:20 Byron Rakitzis
  0 siblings, 0 replies; 4+ messages in thread
From: Byron Rakitzis @ 2001-05-28 17:20 UTC (permalink / raw)
  To: rc, russell.davies

Whether it's a bug depends on your expectations -- but redirections
happen in a subshell and you'd have to know that.

You could do:

exec > /dev/null
cd e
exec > /dev/tty


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-28 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-28  8:47 bug? Russell Davies
2001-05-28 10:55 ` bug? Carlo Strozzi
2001-05-28 15:20 ` bug? Paul Haahr
2001-05-28 17:20 bug? Byron Rakitzis

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).