From hb at biostat.ucsf.edu  Wed Sep 14 19:10:17 2011
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Wed, 14 Sep 2011 10:10:17 -0700
Subject: [Rd] Revision of shell.exec?
In-Reply-To: <74357D3F-67CC-4D09-BBE9-C3988293317F@r-project.org>
References: <4E708194.8060406@gmail.com>
	<4E709447.10305@statistik.tu-dortmund.de>
	<CALh21i+JyvKJf=UGi2ENTXtB5rbbG-DZuwCYtGb97afG7Nguxg@mail.gmail.com>
	<4E70C350.6020506@gmail.com>
	<74357D3F-67CC-4D09-BBE9-C3988293317F@r-project.org>
Message-ID: <CAFDcVCRiTPc1f9q+KnsEAoD3SUtb1Za_4waCw1O0r_PbWQFQ+Q@mail.gmail.com>

On Wed, Sep 14, 2011 at 8:35 AM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
>
> On Sep 14, 2011, at 11:08 AM, Brian Oney wrote:
>
>> Hi Steve,
>>
>> a quick look at "browseURL" will tell you that indeed "system" or "shell.exec" (on a windows platform) is used to open up a URL.
>> The "open " part of the proposed function was written to work on a Mac. Because Mac is a unix platform, I assumed that the function "open" would be omnipresent on unix platforms, my mistake.
>
> Well, the problem is that "open" is unfortunately mapped to openvt on Linux systems which is a quite obscure anachronism. But since Linux is Linux there is no standard way to open a file, so it doesn't really matter ;) -- xdg-utils come closest to what one may call standard but on many systems they are not installed by default (in fact on none of the Linux machines I have around). For URLs R does the hard work to try to figure out what to do with them (it also does the same for PDFs), but you may end up opening things in a browser although that's not what you had in mind.
>
>
>> Well I guess, we know how to make to work on a mac.
>>
>
> Yes, "open" works very well on Macs and is extremely useful (I use it all the time - among other things you can use it with directories to browse them...) - it is still beyond me why other unices don't bother ...

Apple probably patented it.

/Henrik

>
> Cheers,
> Simon
>
>
>
>> I will make the transition to Linux and get back to this in a while, ok?
>>
>> Cheers,
>> Brian
>>
>>
>> On 9/14/2011 2:50 PM, Stephen Weston wrote:
>>> 2011/9/14 Uwe Ligges<ligges at statistik.tu-dortmund.de>:
>>>>
>>>> On 14.09.2011 12:27, Brian Oney wrote:
>>>>> Hi List,
>>>>> I hope this is correct list to propose function extensions, sorry if not.
>>>>> I am preparing for a (hopefully painless) migration to linux. As far as
>>>>> I am aware of, the function "shell.exec" only comes with the windows
>>>>> version. I think this is a handy little function and would like to see
>>>>> my scripts work when I migrate.
>>>>>
>>>>> May I propose something (like the following)?
>>>>>
>>>>> open.file<- function(file) {
>>>>> if(.Platform$OS.type=="windows") {shell.exec(file)} else
>>>>> {system(paste("open ",file))}
>>>>> }
>>>>>
>>>>> Or just a small addition to the shell.exec function and no new named
>>>>> function.
>>>>> Hope the idea isn't received as "too stupid".
>>>> What is "open" supposed to do on a non-Windows machine? I do not have it on
>>>> the only Linux installation I looked at now, hence we obviously cannot
>>>> assume it exists on an arbitrary installation.
>>> I think the nearest equivalent for those running Gnome or KDE may be
>>> "xdg-open". ?So there would probably need to be a new option for specifying
>>> the appropriate command.
>>>
>>> Personally, I am more inclined to use "system" for executing commands,
>>> and "browseURL" for opening documents. ?"browseURL" even uses
>>> "xdg-open" in my R installation on my Linux machine.
>>>
>>> - Steve
>>>
>>>
>>>> Best,
>>>> Uwe Ligges
>>>>
>>>>
>>>>> Cheers,
>>>>> Brian
>>>>>
>>>>> ______________________________________________
>>>>> R-devel at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Revision of shell.exec?
Henrik Bengtsson