[Rd] Suggested modification to shell command

Wright, Kevin kevin.wright@pioneer.com
Fri Jan 10 00:31:02 2003


I'm using R 1.6.1 on Windows 95 with cygwin bash as my shell.

The 'shell' command tries to determine which shell the user prefers via the
following steps:

      shell <- Sys.getenv("R_SHELL")
      if (!nchar(shell)) 
          shell <- Sys.getenv("SHELL")
      if (!nchar(shell)) 
          shell <- Sys.getenv("COMSPEC")

For me, shell evaluates to "c:/cygwin/bin/bash.exe" .

The 'shell' command then tries to determine the proper flag to use:

if (missing(flag) && any(!is.na(match(c("bash", "tcsh"), 
    shell)))) 
    flag <- "-c"

For anyone who is using MS Windows (with .exe file extensions) or has the
path name in the SHELL environment variable (as appears to be the cygwin
default), the following modification to the matching may be more general in
determining the proper flag to use:

is.na(pmatch(c("bash","tcsh"),basename(shell)))

Thank you for considering this suggestion.


Kevin Wright, Research Scientist
Pioneer Hi-Bred Int'l, x4054.




This communication is for use by the intended recipient and cont ... [[dropped]]