Rev 68017 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/Sys.which.Rd% Part of the R package, https://www.R-project.org% Copyright 2007-2014 R Core Team% Distributed under GPL 2 or later\name{Sys.which}\alias{Sys.which}\title{Find Full Paths to Executables}\description{This is an interface to the system command \code{which}, or to anemulation on Windows.}\usage{Sys.which(names)}\arguments{\item{names}{Character vector of names or paths of possible executables.}}\details{The system command \command{which} reports on the full path names ofan executable (including an executable script) as would be executed bya shell, accepting either absolute paths or looking on the path.On Windows an \sQuote{executable} is a file with extension\file{.exe}, \file{.com}, \file{.cmd} or \file{.bat}. Such files neednot actually be executable, but they are what \code{\link{system}}tries.On a Unix-alike the full path to \code{which} (usually\file{/usr/bin/which}) is found when \R is installed.}\value{A character vector of the same length as \code{names}, named by\code{names}. The elements are either the full path to theexecutable or some indication that no executable of that name wasfound. Typically the indication is \code{""}, but this does depend onthe OS (and the known exceptions are changed to \code{""}). Missingvalues in \code{names} have missing return values (as from \R 3.0.0).On Windows the paths will be short paths (8+3 components, no spaces)with \code{\\} as the path delimiter.}\note{Except on Windows this calls the system command \command{which}: sincethat is not part of e.g.\sspace{}the POSIX standards, exactly what it does isOS-dependent. It will usually do tilde-expansion and it may make useof \command{csh} aliases.In \R 2.x.y, arguments containing spaces or other metacharactersneeded to be escaped as they would be for a shell: for example Windowspaths containing spaces needed to be enclosed in double quotes.}\examples{## the first two are likely to exist everywhere## texi2dvi exists on most Unix-alikes and under MiKTeXSys.which(c("ftp", "ping", "texi2dvi", "this-does-not-exist"))}\keyword{ utilities }