| 42479 |
ripley |
1 |
% File src/library/base/man/Sys.which.Rd
|
| 68948 |
ripley |
2 |
% Part of the R package, https://www.R-project.org
|
| 71883 |
ripley |
3 |
% Copyright 2007-2017 R Core Team
|
| 42479 |
ripley |
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
|
|
6 |
\name{Sys.which}
|
| 56186 |
murdoch |
7 |
\alias{Sys.which}
|
| 52810 |
ripley |
8 |
\title{Find Full Paths to Executables}
|
| 42479 |
ripley |
9 |
\description{
|
| 59542 |
ripley |
10 |
This is an interface to the system command \code{which}, or to an
|
|
|
11 |
emulation on Windows.
|
| 42479 |
ripley |
12 |
}
|
|
|
13 |
\usage{
|
|
|
14 |
Sys.which(names)
|
|
|
15 |
}
|
|
|
16 |
\arguments{
|
| 59542 |
ripley |
17 |
\item{names}{Character vector of names or paths of possible executables.}
|
| 42479 |
ripley |
18 |
}
|
|
|
19 |
\details{
|
| 59522 |
ripley |
20 |
The system command \command{which} reports on the full path names of
|
|
|
21 |
an executable (including an executable script) as would be executed by
|
|
|
22 |
a shell, accepting either absolute paths or looking on the path.
|
| 42479 |
ripley |
23 |
|
| 50567 |
ripley |
24 |
On Windows an \sQuote{executable} is a file with extension
|
|
|
25 |
\file{.exe}, \file{.com}, \file{.cmd} or \file{.bat}. Such files need
|
| 52810 |
ripley |
26 |
not actually be executable, but they are what \code{\link{system}}
|
| 50567 |
ripley |
27 |
tries.
|
| 61433 |
ripley |
28 |
|
| 53037 |
ripley |
29 |
On a Unix-alike the full path to \code{which} (usually
|
| 59522 |
ripley |
30 |
\file{/usr/bin/which}) is found when \R is installed.
|
| 42479 |
ripley |
31 |
}
|
|
|
32 |
\value{
|
|
|
33 |
A character vector of the same length as \code{names}, named by
|
|
|
34 |
\code{names}. The elements are either the full path to the
|
| 52810 |
ripley |
35 |
executable or some indication that no executable of that name was
|
| 51774 |
ripley |
36 |
found. Typically the indication is \code{""}, but this does depend on
|
| 61425 |
ripley |
37 |
the OS (and the known exceptions are changed to \code{""}). Missing
|
| 71883 |
ripley |
38 |
values in \code{names} have missing return values.
|
| 42480 |
ripley |
39 |
|
| 59542 |
ripley |
40 |
On Windows the paths will be short paths (8+3 components, no spaces)
|
| 90027 |
hornik |
41 |
with \samp{\\} as the path delimiter.
|
| 42479 |
ripley |
42 |
}
|
| 59522 |
ripley |
43 |
\note{
|
|
|
44 |
Except on Windows this calls the system command \command{which}: since
|
| 66444 |
hornik |
45 |
that is not part of e.g.\sspace{}the POSIX standards, exactly what it does is
|
| 59522 |
ripley |
46 |
OS-dependent. It will usually do tilde-expansion and it may make use
|
|
|
47 |
of \command{csh} aliases.
|
|
|
48 |
}
|
| 42479 |
ripley |
49 |
\examples{
|
| 42480 |
ripley |
50 |
## the first two are likely to exist everywhere
|
| 87699 |
smeyer |
51 |
## texi2dvi exists on most Unix-alikes but not under MiKTeX
|
| 42480 |
ripley |
52 |
Sys.which(c("ftp", "ping", "texi2dvi", "this-does-not-exist"))
|
| 42479 |
ripley |
53 |
}
|
|
|
54 |
\keyword{ utilities }
|