Colleagues, I am preparing scripts that will be used by others on both Windows and Linux/OSX platforms. The scripts call an existing Fortran application. The user may have any of a a variety of Fortran compilers - my goal is to determine whether or not the test command returns "no input files" or "command not found" (i.e., so that I can confirm which Fortran they are using).
In OS X and Linux, I can do the following: > > TEST <- system("g77 2>&1", intern=TRUE) > > TEST > [1] "g77: no input files" > > > TEST <- system("f77 2>&1", intern=TRUE) > > TEST > [1] "sh: f77: command not found" I can then use grep to determine which of the two strings was returned. In Windows: > > TEST <- system("g95 2>&1") > g95: 2>&1: Invalid argument > > TEST > [1] 0 > attr(, "exec.status"): > [1] 0 > attr(, "exit.status"): > [1] 0 > > > > TEST <- system("g95") > g95: no input files > > TEST > [1] 0 > attr(, "exec.status"): > [1] 0 > attr(, "exit.status"): > [1] 0 As you can see, Windows replies "no input files"; however, that info is not captured in TEST. I presume that this is because standard error is dealt with different in Windows compared to Unix-line platforms. Any thoughts on how to capture standard error in Windows? Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone: 1-866-PLessThan (1-866-753-7784) Fax: 1-415-564-2220 www.PLessThan.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.