Skip to content
Prev 1634 / 63435 Next

[R & Unix ..] system("test",...) gives funny results...

But surely that is not the way to do this (and how is it going to work on
Windows?)  S-PLUS uses a system call for file.exists, presumably to
access(), even on Unix.

If you want to use test, do remember that what you get is shell-specific.
If you use

system("/usr/bin/test -e /tmp")

you have some chance of working on different shells. (Even Linux, RH5.2,
has test at /usr/bin/test!)


[still interested to hear about the potential of an R builtin 'test',
 relying on GNU sh-utils].

Why not use POSIX system calls instead?