pinard@progiciels-bpi.ca
2006-Feb-22  18:41 UTC
[Rd] Spurious output white line in R script (PR#8631)
I noticed that R scripts produce a spurious white line after output.
For example, the following shell script,
#!/bin/sh
R --slave --vanilla <<EOF
cat("Hello\n")
EOF
when made executable under the name ``hello`` along the search path, behaves
like this:
$ hello | od -bc
0000000 110 145 154 154 157 012 012
          H   e   l   l   o  \n  \n
0000007
The second newline is not wanted, and I would like if R was not
producing it.
--please do not edit the information below--
Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = 
 major = 2
 minor = 2.1
 year = 2005
 month = 12
 day = 20
 svn rev = 36812
 language = R
Locale:
LC_CTYPE=fr_CA.UTF-8;LC_NUMERIC=C;LC_TIME=fr_CA.UTF-8;LC_COLLATE=fr_CA.UTF-8;LC_MONETARY=fr_CA.UTF-8;LC_MESSAGES=fr_CA.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
Search Path:
 .GlobalEnv, package:methods, package:stats, package:graphics, package:utils,
package:datasets, fp.etc, package:grDevices, Autoloads, package:base
I don't see the bug here ... you may want to explain how this behavior conflicts with the documentation. As of your problem, see below. On Feb 22, 2006, at 1:41 PM, pinard at progiciels-bpi.ca wrote:> I noticed that R scripts produce a spurious white line after output. > For example, the following shell script, > > > #!/bin/sh > R --slave --vanilla <<EOF > > cat("Hello\n") > > EOF > > > when made executable under the name ``hello`` along the search > path, behaves > like this: > > > $ hello | od -bc > 0000000 110 145 154 154 157 012 012 > H e l l o \n \n > 0000007 > > > > The second newline is not wanted, and I would like if R was not > producing it. >If you don't want it, tell R to explicitly terminate in your script, e.g. with quit("no",0) - then there will be no new line. Cheers, Simon