On Thu, 24 Jun 2004, Shin, Daehyok wrote:
> Rather than using system() to execute a shell command,
> is there a way to emulate the system shell itself in R?
> For instance, if the function is shell,
>
> > getwd()
> [1] "/home/a/b"
> > shell() # From R to system shell
> $cd .. # cd command in system shell
> $CTRL+D # Return to R
> > getwd()
> [1] "/home/a"
system("/bin/sh") does this for you under a Unix-alike. But as spawning a
shell as cd-ing in the child does not change the working directory of the
parent, the emulation would be imperfect if this worked in R.
Do try it in your favourite shell!
--
Brian D. Ripley, [EMAIL PROTECTED]
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html