From edd at debian.org  Sun Oct 18 15:52:28 2009
From: edd at debian.org (Dirk Eddelbuettel)
Date: Sun, 18 Oct 2009 08:52:28 -0500
Subject: [Rd] Rscript not returning zero
In-Reply-To: <alpine.LFD.2.00.0910180612130.28565@gannet.stats.ox.ac.uk>
References: <cad62a920910171906rfed2f81u5111443fc4468377@mail.gmail.com>
	<alpine.LFD.2.00.0910180612130.28565@gannet.stats.ox.ac.uk>
Message-ID: <19163.7580.961632.927403@ron.nulle.part>


On 18 October 2009 at 06:22, Prof Brian Ripley wrote:
| On Sat, 17 Oct 2009, Rodrigo Flores wrote:
| > Is there any way to get the Rscript returning zero ?
| 
| Have a successful script ....
| 
| You have not told us the 'at a minimum' information asked for in the 
| posting guide, whereas I get (under sh)
| 
| sh-3.2$ Rscript -e 'sessionInfo()'
| R version 2.9.2 (2009-08-24)
| x86_64-unknown-linux-gnu
| 
| locale:
| LC_CTYPE=en_GB.utf8;LC_NUMERIC=C;LC_TIME=en_GB.utf8;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=en_GB.utf8;LC_PAPER=en_GB.utf8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.utf8;LC_IDENTIFICATION=C
| 
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  base
| sh-3.2$ echo $?
| 0
| 
| so please give a reproducible example of a successful script not 
| returning zero.

Moreover, Rscript and r (i.e. littler) both support custom return codes:

edd at ron:~$ Rscript -e 'q(42,save="no")'
edd at ron:~$ echo $?
42
edd at ron:~$ r -e 'q(42,save="no")'
edd at ron:~$ echo $?
42
edd at ron:~$

Dirk

-- 
Three out of two people have difficulties with fractions.



[Rd] Rscript not returning zero
Dirk Eddelbuettel