The R Project SVN R

Rev

Rev 59039 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/base/man/commandArgs.Rd
2
% Part of the R package, http://www.R-project.org
59039 ripley 3
% Copyright 1995-2007 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
5646 duncan 6
\name{commandArgs}
56186 murdoch 7
\alias{commandArgs}
7081 pd 8
\title{Extract Command Line Arguments}
7211 hornik 9
\description{
10
  Provides access to a copy of the command line arguments supplied when
11
  this \R session was invoked.
12
}
5646 duncan 13
\usage{
42026 ripley 14
commandArgs(trailingOnly = FALSE)
5646 duncan 15
}
40428 ripley 16
\arguments{
17
  \item{trailingOnly}{logical.  Should only arguments after
49704 hornik 18
    \option{--args} be returned?}
40428 ripley 19
}
5646 duncan 20
\details{
7211 hornik 21
  These arguments are captured before the standard \R command line
22
  processing takes place.  This means that they are the unmodified
49704 hornik 23
  values.  This is especially useful with the \option{--args}
42026 ripley 24
  command-line flag to \R, as all of the command line after that flag
25
  is skipped.
5646 duncan 26
}
27
\value{
7211 hornik 28
  A character vector containing the name of the executable and the
29
  user-supplied command line arguments.  The first element is the name
42026 ripley 30
  of the executable by which \R was invoked.  The exact form of this
31
  element is platform dependent: it may be the fully qualified name, or
32
  simply the last component (or basename) of the application, or for an
33
  embedded \R it can be anything the programmer supplied.
40428 ripley 34
 
42026 ripley 35
  If \code{trailingOnly = TRUE}, a character vector of those arguments
49704 hornik 36
  (if any) supplied after \option{--args}.
5646 duncan 37
}
34892 maechler 38
\seealso{\code{\link{Startup}}
6137 ripley 39
#ifdef unix
34892 maechler 40
\code{\link{BATCH}}
6137 ripley 41
#endif
34892 maechler 42
}
5646 duncan 43
\examples{
7211 hornik 44
commandArgs()
42026 ripley 45
## Spawn a copy of this application as it was invoked,
46
## subject to shell quoting issues
61150 ripley 47
## system(paste(commandArgs(), collapse = " "))
5646 duncan 48
}
49
\keyword{environment}
50
\keyword{sysdata}
51
\keyword{programming}