[R] [FORGED] file.exists() on device files
Benjamin Tyner
btyner at gmail.com
Fri Jan 13 12:54:35 CET 2017
Thank you for the insights, Rolf and Henrik.
To give another example, this time in non-interactive mode,
Rscript -e "file.exists(commandArgs(TRUE))" <(echo "Hi")
[1] TRUE
versus
Rscript -e "normalizePath(commandArgs(TRUE))" <(echo "Hi")
[1] "/dev/fd/63"
Warning message:
In normalizePath(commandArgs(TRUE)) :
path[1]="/dev/fd/63": No such file or directory
It almost seems like file.exists and normalizePath use separate criteria
for determining existence?
Regards
Ben
On 01/12/2017 01:42 AM, Rolf Turner wrote:
> On 12/01/17 16:33, Henrik Bengtsson wrote:
>
> <SNIP>
>
>> FYI, the /proc is there because Unix has something called the "proc
>> filesystem (procfs; https://en.wikipedia.org/wiki/Procfs) is a special
>> filesystem in Unix-like operating systems that presents information
>> about processes and other system information in a hierarchical
>> file-like structure". For instance, you can query the uptime of the
>> machine by reading from /proc/uptime:
>>
>> $ cat /proc/uptime
>> 332826.96 661438.10
>>
>> $ cat /proc/uptime
>> 332871.40 661568.50
>>
>>
>> You can get all IDs (PIDs) of all processes currently running:
>>
>> $ ls /proc/ | grep -E '^[0-9]+$'
>>
>> and for each process you there are multiple attributes mapped as
>> files, e.g. if I start R as:
>>
>> $ R --args -e "message('hello there')"
>>
>> then I can query that process as:
>>
>> $ pid=$(pidof R)
>> $ echo $pid
>> 26323
>>
>> $ cat /proc/26323/cmdline
>> /usr/lib/R/bin/exec/R--args-emessage('hello there')
>>
>> Unix is neat
>
> Indeed. Couldn't agree more. Thanks for the insight.
>
> <SNIP>
>
> cheers,
>
> Rolf
>
More information about the R-help
mailing list