Re: [Rd] Rscript on Windows
On 2/17/2007 10:57 AM, Gabor Grothendieck wrote: [ deletions ] > Also I think that the success of R in the community is such that the core > developers do have some responsibility to the community at large beyond > their own needs. I'd agree with this, as long as you don't limit it to the core developers. We all have some responsibility to the community at large beyond our own needs. But I think we also all have the right to decide how to prioritize those responsibilities. much as a business which when it gets to a certain size > and prominence has certain responsibilities to society beyond its own > purposes and some reasonable compromise between their own needs > and obvious requirements to complete certain work or do it to a certain > level of quality needs to be taken account of. Sounds like you should contact Microsoft, and try to get them to take their responsibilities seriously, and support #! syntax in CMD.EXE. They've got a lot more resources than the R core group has. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Rscript on Windows
Just because its open source does not mean everyone should do everything. I suspect I have more expertise in Windows batch than the core developers and also suspect they have more knowledge of the core than I so its a good division of labor if I provide the batch files and they add -x since it takes me less time to produce batch files and they less time to add -x. Furthermore its possible to develop something for the core and then have it rejected and while hopefully this won't happen or if does it happens for good reason, if one works on an external package then there is no chance the work will be wasted since you have control over it. In general the idea of having external packages has seemed to work well and allows parallel development in a maximal way so the idea of having the core work on the core and others work externally has been successful. While no one has to provide Rscript or -x or anything else that applies to me too and I didn't have to develop the external supporting Windows-specific software in batchfiles or make it available to yet it is now available for you and others to use with R 2.5.0 (via svn and more formally when I release it to CRAN probably when R 2.5.0 is released). Also I think that the success of R in the community is such that the core developers do have some responsibility to the community at large beyond their own needs.much as a business which when it gets to a certain size and prominence has certain responsibilities to society beyond its own purposes and some reasonable compromise between their own needs and obvious requirements to complete certain work or do it to a certain level of quality needs to be taken account of. On 2/17/07, Gavin Simpson <[EMAIL PROTECTED]> wrote: > On Sat, 2007-02-17 at 09:31 -0500, Gabor Grothendieck wrote: > > Surely R has higher standards than that. How about quality and > > completeness of implementation? > > > > Every other major scripting language has implemented this for good reason > > and its a glaring omission. > > I think you are forgetting that R is an open source project, and is > reliant on the generous efforts of the R community, and in particular > the Core development team, for any work done on it. > > I disagree with your statement about core mods being best done by the > core group - we all benefit when anyone, core or otherwise, contributes > to R. Duncan has already offered to review a submitted patch and > therefore commit some of his time to improving this feature - and this > is how it should work for those features that are of lower priority to > the core team. > > However, that is your opinion and you are free to contribute directly to > R or not or contribute in some other way (as R-help subscribers know you > do to their benefit). But Core developers have that same right, and I'm > sure there are numerous other things in R that they might consider to be > incompletely implemented, in need of improvement or just plain missing > and therefore more deserving of their attention. Otherwise the SVN logs > wouldn't be quite so active... > > G > > > > > On 2/17/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > > On 2/17/2007 7:31 AM, Gabor Grothendieck wrote: > > > > I think its best if core mods are done by the core group while others > > > > focus on work that can be done external to the core. > > > > > > Fair enough, but then you also have to accept that the core group is > > > going to set the priorities. As far as I know *nobody* in the core > > > group uses the CMD.EXE shell regularly, so changes to accommodate its > > > limitations are going to get low priority. > > > > > > Duncan Murdoch > > > > > > > > > > > Thus, what I have done is to enhance the batchfiles distribution with > > > > 3 new batchfiles: Rscript.bat, #Rscript.bat and runR.bat which will be > > > > part of the > > > > next distribution of batchfiles but can be obtained now, if desired, > > > > from the > > > > batchfiles svn (with the caveat that they require R 2.5.0). The > > > > batchfiles > > > > home page is here: > > > > > > > >http://code.google.com/p/batchfiles > > > > > > > > The source tab on that page gets you to the svn and the links on the > > > > right > > > > include links to the NEWS and README files which describe the additions, > > > > a link to info on the Windows bug that I mentioned and two perl links > > > > that > > > > describe how this all works in perl which may be a helpful analogous > > > > situation. > > > > . > > > > On 2/17/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > > >> On 2/16/2007 9:35 AM, Gabor Grothendieck wrote: > > > >>> I mentioned this twice already and no one answered;however, I am > > > >>> mentioning > > > >>> this a third time since its a serious deficiency. > > > >> I agree this would be a reasonable addition, but I wouldn't class it as > > > >> a serious deficiency, and I don't plan to work on it myself. > > > >> > > > >> If you want to put together patches to the trunk code and docs t
Re: [Rd] Rscript on Windows
On Sat, 2007-02-17 at 09:31 -0500, Gabor Grothendieck wrote: > Surely R has higher standards than that. How about quality and > completeness of implementation? > > Every other major scripting language has implemented this for good reason > and its a glaring omission. I think you are forgetting that R is an open source project, and is reliant on the generous efforts of the R community, and in particular the Core development team, for any work done on it. I disagree with your statement about core mods being best done by the core group - we all benefit when anyone, core or otherwise, contributes to R. Duncan has already offered to review a submitted patch and therefore commit some of his time to improving this feature - and this is how it should work for those features that are of lower priority to the core team. However, that is your opinion and you are free to contribute directly to R or not or contribute in some other way (as R-help subscribers know you do to their benefit). But Core developers have that same right, and I'm sure there are numerous other things in R that they might consider to be incompletely implemented, in need of improvement or just plain missing and therefore more deserving of their attention. Otherwise the SVN logs wouldn't be quite so active... G > > On 2/17/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > On 2/17/2007 7:31 AM, Gabor Grothendieck wrote: > > > I think its best if core mods are done by the core group while others > > > focus on work that can be done external to the core. > > > > Fair enough, but then you also have to accept that the core group is > > going to set the priorities. As far as I know *nobody* in the core > > group uses the CMD.EXE shell regularly, so changes to accommodate its > > limitations are going to get low priority. > > > > Duncan Murdoch > > > > > > > > Thus, what I have done is to enhance the batchfiles distribution with > > > 3 new batchfiles: Rscript.bat, #Rscript.bat and runR.bat which will be > > > part of the > > > next distribution of batchfiles but can be obtained now, if desired, from > > > the > > > batchfiles svn (with the caveat that they require R 2.5.0). The > > > batchfiles > > > home page is here: > > > > > >http://code.google.com/p/batchfiles > > > > > > The source tab on that page gets you to the svn and the links on the right > > > include links to the NEWS and README files which describe the additions, > > > a link to info on the Windows bug that I mentioned and two perl links that > > > describe how this all works in perl which may be a helpful analogous > > > situation. > > > . > > > On 2/17/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > >> On 2/16/2007 9:35 AM, Gabor Grothendieck wrote: > > >>> I mentioned this twice already and no one answered;however, I am > > >>> mentioning > > >>> this a third time since its a serious deficiency. > > >> I agree this would be a reasonable addition, but I wouldn't class it as > > >> a serious deficiency, and I don't plan to work on it myself. > > >> > > >> If you want to put together patches to the trunk code and docs to > > >> implement this I'll review them and possibly commit them. If you don't > > >> see this as a high enough priority to do that, then I'd suggest doing > > >> what I do: don't use the CMD.EXE shell. There are a number of > > >> Unix-like shells available in Windows (Cygwin, MSYS, etc.) that can > > >> handle the #! syntax just fine. Or just use two files, as you describe > > >> below. > > >> > > >> Duncan Murdoch > > >> > > >> > The Rscript facility > > >>> that is upcoming in R is useful but on Windows one will often be > > >>> relegated > > >>> to having two files: a batch file and an R file unless the -x switch > > >>> is implemented > > >>> to allow them to be combined. This is not a problem on UNIX which > > >>> supports > > >>> #! but on Windows we need -x. Every other common scripting language > > >>> including > > >>> perl, python and ruby supports -x for this purpose. > > >>> > > >>> (The -x flag would start R processing at the first line that begins > > >>> with #! so > > >>> that prior lines could be Windows batch commands allowing the same file > > >>> to be used as a batch file and an R file.) > > >>> > > >>> Note that there is a bug in Windows which means that if you simply > > >>> associate > > >>> .R to running R then the result cannot be redirected. There is a bug > > >>> fix available > > >>> for this but I think we need to be able to run out of the box for > > >>> something this > > >>> common. > > >>> > > >>> > > >>> On 1/29/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > > Haven't got any feedback on this one. > > > > Will we be getting a perl/python/ruby style -x switch for Rscript for > > R 2.5.0? > > > > It certainly would give more flexibility to users of Rscript on > > non-UNIX systems > > where #! notation is not available. > > > > On 1/26/07, Gabor Grothen
Re: [Rd] Rscript on Windows
> Surely R has higher standards than that. How about quality and > completeness of implementation? > > Every other major scripting language has implemented this for good > reason and its a glaring omission. Gabor, can we get a URL from you to a patch that implements this functionality? Thanks! --elijah __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Rscript on Windows
Surely R has higher standards than that. How about quality and completeness of implementation? Every other major scripting language has implemented this for good reason and its a glaring omission. On 2/17/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > On 2/17/2007 7:31 AM, Gabor Grothendieck wrote: > > I think its best if core mods are done by the core group while others > > focus on work that can be done external to the core. > > Fair enough, but then you also have to accept that the core group is > going to set the priorities. As far as I know *nobody* in the core > group uses the CMD.EXE shell regularly, so changes to accommodate its > limitations are going to get low priority. > > Duncan Murdoch > > > > > Thus, what I have done is to enhance the batchfiles distribution with > > 3 new batchfiles: Rscript.bat, #Rscript.bat and runR.bat which will be > > part of the > > next distribution of batchfiles but can be obtained now, if desired, from > > the > > batchfiles svn (with the caveat that they require R 2.5.0). The batchfiles > > home page is here: > > > >http://code.google.com/p/batchfiles > > > > The source tab on that page gets you to the svn and the links on the right > > include links to the NEWS and README files which describe the additions, > > a link to info on the Windows bug that I mentioned and two perl links that > > describe how this all works in perl which may be a helpful analogous > > situation. > > . > > On 2/17/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > >> On 2/16/2007 9:35 AM, Gabor Grothendieck wrote: > >>> I mentioned this twice already and no one answered;however, I am > >>> mentioning > >>> this a third time since its a serious deficiency. > >> I agree this would be a reasonable addition, but I wouldn't class it as > >> a serious deficiency, and I don't plan to work on it myself. > >> > >> If you want to put together patches to the trunk code and docs to > >> implement this I'll review them and possibly commit them. If you don't > >> see this as a high enough priority to do that, then I'd suggest doing > >> what I do: don't use the CMD.EXE shell. There are a number of > >> Unix-like shells available in Windows (Cygwin, MSYS, etc.) that can > >> handle the #! syntax just fine. Or just use two files, as you describe > >> below. > >> > >> Duncan Murdoch > >> > >> > The Rscript facility > >>> that is upcoming in R is useful but on Windows one will often be relegated > >>> to having two files: a batch file and an R file unless the -x switch > >>> is implemented > >>> to allow them to be combined. This is not a problem on UNIX which > >>> supports > >>> #! but on Windows we need -x. Every other common scripting language > >>> including > >>> perl, python and ruby supports -x for this purpose. > >>> > >>> (The -x flag would start R processing at the first line that begins with > >>> #! so > >>> that prior lines could be Windows batch commands allowing the same file > >>> to be used as a batch file and an R file.) > >>> > >>> Note that there is a bug in Windows which means that if you simply > >>> associate > >>> .R to running R then the result cannot be redirected. There is a bug > >>> fix available > >>> for this but I think we need to be able to run out of the box for > >>> something this > >>> common. > >>> > >>> > >>> On 1/29/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Haven't got any feedback on this one. > > Will we be getting a perl/python/ruby style -x switch for Rscript for R > 2.5.0? > > It certainly would give more flexibility to users of Rscript on non-UNIX > systems > where #! notation is not available. > > On 1/26/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > > Good idea. ruby seems to work the same way. python does too but with > > a slightly different definition: > > > > C:\> ruby -h | findstr strip > > -x[directory] strip off text before #!ruby line and perhaps cd to > > directory > > > > C:\> perl -h | findstr strip > > -x[directory] strip off text before #!perl line and perhaps cd to > > directory > > > > C:\> python -h | findstr skip > > -x : skip first line of source, allowing use of non-Unix forms of > > #!cmd > > > > > > On 1/26/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: > >> ActivePerl has '-x' switch which tells it to skip all lines in the > >> file till > >> "#!". > >> This allows writing perl scripts in ordinary .bat files. > >> > >> ?shQuote contains a link with the following perl script example: > >> ===8<=== > >> @echo off > >> :: hello.bat > >> :: Windows executable Perl script > >> :: Note: > >> :: assumes perl.exe is in path > >> :: otherwise, use absolute path > >> perl -x -S "%0" %* > >> goto end > >> #!perl > >> > >> print "Hello, World!\n"; > >> __END__ > >> :end > >> :: -- end o
Re: [Rd] Rscript on Windows
On 2/17/2007 7:31 AM, Gabor Grothendieck wrote: > I think its best if core mods are done by the core group while others > focus on work that can be done external to the core. Fair enough, but then you also have to accept that the core group is going to set the priorities. As far as I know *nobody* in the core group uses the CMD.EXE shell regularly, so changes to accommodate its limitations are going to get low priority. Duncan Murdoch > > Thus, what I have done is to enhance the batchfiles distribution with > 3 new batchfiles: Rscript.bat, #Rscript.bat and runR.bat which will be > part of the > next distribution of batchfiles but can be obtained now, if desired, from the > batchfiles svn (with the caveat that they require R 2.5.0). The batchfiles > home page is here: > >http://code.google.com/p/batchfiles > > The source tab on that page gets you to the svn and the links on the right > include links to the NEWS and README files which describe the additions, > a link to info on the Windows bug that I mentioned and two perl links that > describe how this all works in perl which may be a helpful analogous > situation. > . > On 2/17/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: >> On 2/16/2007 9:35 AM, Gabor Grothendieck wrote: >>> I mentioned this twice already and no one answered;however, I am mentioning >>> this a third time since its a serious deficiency. >> I agree this would be a reasonable addition, but I wouldn't class it as >> a serious deficiency, and I don't plan to work on it myself. >> >> If you want to put together patches to the trunk code and docs to >> implement this I'll review them and possibly commit them. If you don't >> see this as a high enough priority to do that, then I'd suggest doing >> what I do: don't use the CMD.EXE shell. There are a number of >> Unix-like shells available in Windows (Cygwin, MSYS, etc.) that can >> handle the #! syntax just fine. Or just use two files, as you describe >> below. >> >> Duncan Murdoch >> >> > The Rscript facility >>> that is upcoming in R is useful but on Windows one will often be relegated >>> to having two files: a batch file and an R file unless the -x switch >>> is implemented >>> to allow them to be combined. This is not a problem on UNIX which supports >>> #! but on Windows we need -x. Every other common scripting language >>> including >>> perl, python and ruby supports -x for this purpose. >>> >>> (The -x flag would start R processing at the first line that begins with #! >>> so >>> that prior lines could be Windows batch commands allowing the same file >>> to be used as a batch file and an R file.) >>> >>> Note that there is a bug in Windows which means that if you simply associate >>> .R to running R then the result cannot be redirected. There is a bug >>> fix available >>> for this but I think we need to be able to run out of the box for something >>> this >>> common. >>> >>> >>> On 1/29/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: Haven't got any feedback on this one. Will we be getting a perl/python/ruby style -x switch for Rscript for R 2.5.0? It certainly would give more flexibility to users of Rscript on non-UNIX systems where #! notation is not available. On 1/26/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Good idea. ruby seems to work the same way. python does too but with > a slightly different definition: > > C:\> ruby -h | findstr strip > -x[directory] strip off text before #!ruby line and perhaps cd to > directory > > C:\> perl -h | findstr strip > -x[directory] strip off text before #!perl line and perhaps cd to > directory > > C:\> python -h | findstr skip > -x : skip first line of source, allowing use of non-Unix forms of > #!cmd > > > On 1/26/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: >> ActivePerl has '-x' switch which tells it to skip all lines in the file >> till >> "#!". >> This allows writing perl scripts in ordinary .bat files. >> >> ?shQuote contains a link with the following perl script example: >> ===8<=== >> @echo off >> :: hello.bat >> :: Windows executable Perl script >> :: Note: >> :: assumes perl.exe is in path >> :: otherwise, use absolute path >> perl -x -S "%0" %* >> goto end >> #!perl >> >> print "Hello, World!\n"; >> __END__ >> :end >> :: -- end of hello.bat -- >> >> Windows Notes: >> " -x " (lower case x): Skip all text until shebang line. >> " -S " (upper case S): Look for script using PATH variable. Special >> meaning >> in Windows: appends .bat or .cmd if lookup for name fails and name does >> not >> have either suffix. >> " %* " only on WinNT/2K/XP; use %1 %2 . . . %9 on Win9x/DOS >> ===8<=== >> >> I think the simplest way to implement shebang on windows would be >> embedding
Re: [Rd] Rscript on Windows
I think its best if core mods are done by the core group while others focus on work that can be done external to the core. Thus, what I have done is to enhance the batchfiles distribution with 3 new batchfiles: Rscript.bat, #Rscript.bat and runR.bat which will be part of the next distribution of batchfiles but can be obtained now, if desired, from the batchfiles svn (with the caveat that they require R 2.5.0). The batchfiles home page is here: http://code.google.com/p/batchfiles The source tab on that page gets you to the svn and the links on the right include links to the NEWS and README files which describe the additions, a link to info on the Windows bug that I mentioned and two perl links that describe how this all works in perl which may be a helpful analogous situation. . On 2/17/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > On 2/16/2007 9:35 AM, Gabor Grothendieck wrote: > > I mentioned this twice already and no one answered;however, I am mentioning > > this a third time since its a serious deficiency. > > I agree this would be a reasonable addition, but I wouldn't class it as > a serious deficiency, and I don't plan to work on it myself. > > If you want to put together patches to the trunk code and docs to > implement this I'll review them and possibly commit them. If you don't > see this as a high enough priority to do that, then I'd suggest doing > what I do: don't use the CMD.EXE shell. There are a number of > Unix-like shells available in Windows (Cygwin, MSYS, etc.) that can > handle the #! syntax just fine. Or just use two files, as you describe > below. > > Duncan Murdoch > > > The Rscript facility > > that is upcoming in R is useful but on Windows one will often be relegated > > to having two files: a batch file and an R file unless the -x switch > > is implemented > > to allow them to be combined. This is not a problem on UNIX which supports > > #! but on Windows we need -x. Every other common scripting language > > including > > perl, python and ruby supports -x for this purpose. > > > > (The -x flag would start R processing at the first line that begins with #! > > so > > that prior lines could be Windows batch commands allowing the same file > > to be used as a batch file and an R file.) > > > > Note that there is a bug in Windows which means that if you simply associate > > .R to running R then the result cannot be redirected. There is a bug > > fix available > > for this but I think we need to be able to run out of the box for something > > this > > common. > > > > > > On 1/29/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > >> Haven't got any feedback on this one. > >> > >> Will we be getting a perl/python/ruby style -x switch for Rscript for R > >> 2.5.0? > >> > >> It certainly would give more flexibility to users of Rscript on non-UNIX > >> systems > >> where #! notation is not available. > >> > >> On 1/26/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > >>> Good idea. ruby seems to work the same way. python does too but with > >>> a slightly different definition: > >>> > >>> C:\> ruby -h | findstr strip > >>> -x[directory] strip off text before #!ruby line and perhaps cd to > >>> directory > >>> > >>> C:\> perl -h | findstr strip > >>> -x[directory] strip off text before #!perl line and perhaps cd to > >>> directory > >>> > >>> C:\> python -h | findstr skip > >>> -x : skip first line of source, allowing use of non-Unix forms of > >>> #!cmd > >>> > >>> > >>> On 1/26/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: > ActivePerl has '-x' switch which tells it to skip all lines in the file > till > "#!". > This allows writing perl scripts in ordinary .bat files. > > ?shQuote contains a link with the following perl script example: > ===8<=== > @echo off > :: hello.bat > :: Windows executable Perl script > :: Note: > :: assumes perl.exe is in path > :: otherwise, use absolute path > perl -x -S "%0" %* > goto end > #!perl > > print "Hello, World!\n"; > __END__ > :end > :: -- end of hello.bat -- > > Windows Notes: > " -x " (lower case x): Skip all text until shebang line. > " -S " (upper case S): Look for script using PATH variable. Special > meaning > in Windows: appends .bat or .cmd if lookup for name fails and name does > not > have either suffix. > " %* " only on WinNT/2K/XP; use %1 %2 . . . %9 on Win9x/DOS > ===8<=== > > I think the simplest way to implement shebang on windows would be > embedding > one more command line switch with similar functionality to perl's '-x'. > > -- > View this message in context: > http://www.nabble.com/Rscript-on-Windows-tf3120774.html#a8651815 > Sent from the R devel mailing list archive at Nabble.com. > > > > > __ > > R-devel@r-project.org mailing li
Re: [Rd] Rscript on Windows
On 2/16/2007 9:35 AM, Gabor Grothendieck wrote: > I mentioned this twice already and no one answered;however, I am mentioning > this a third time since its a serious deficiency. I agree this would be a reasonable addition, but I wouldn't class it as a serious deficiency, and I don't plan to work on it myself. If you want to put together patches to the trunk code and docs to implement this I'll review them and possibly commit them. If you don't see this as a high enough priority to do that, then I'd suggest doing what I do: don't use the CMD.EXE shell. There are a number of Unix-like shells available in Windows (Cygwin, MSYS, etc.) that can handle the #! syntax just fine. Or just use two files, as you describe below. Duncan Murdoch > The Rscript facility > that is upcoming in R is useful but on Windows one will often be relegated > to having two files: a batch file and an R file unless the -x switch > is implemented > to allow them to be combined. This is not a problem on UNIX which supports > #! but on Windows we need -x. Every other common scripting language including > perl, python and ruby supports -x for this purpose. > > (The -x flag would start R processing at the first line that begins with #! so > that prior lines could be Windows batch commands allowing the same file > to be used as a batch file and an R file.) > > Note that there is a bug in Windows which means that if you simply associate > .R to running R then the result cannot be redirected. There is a bug > fix available > for this but I think we need to be able to run out of the box for something > this > common. > > > On 1/29/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: >> Haven't got any feedback on this one. >> >> Will we be getting a perl/python/ruby style -x switch for Rscript for R >> 2.5.0? >> >> It certainly would give more flexibility to users of Rscript on non-UNIX >> systems >> where #! notation is not available. >> >> On 1/26/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: >>> Good idea. ruby seems to work the same way. python does too but with >>> a slightly different definition: >>> >>> C:\> ruby -h | findstr strip >>> -x[directory] strip off text before #!ruby line and perhaps cd to >>> directory >>> >>> C:\> perl -h | findstr strip >>> -x[directory] strip off text before #!perl line and perhaps cd to >>> directory >>> >>> C:\> python -h | findstr skip >>> -x : skip first line of source, allowing use of non-Unix forms of #!cmd >>> >>> >>> On 1/26/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: ActivePerl has '-x' switch which tells it to skip all lines in the file till "#!". This allows writing perl scripts in ordinary .bat files. ?shQuote contains a link with the following perl script example: ===8<=== @echo off :: hello.bat :: Windows executable Perl script :: Note: :: assumes perl.exe is in path :: otherwise, use absolute path perl -x -S "%0" %* goto end #!perl print "Hello, World!\n"; __END__ :end :: -- end of hello.bat -- Windows Notes: " -x " (lower case x): Skip all text until shebang line. " -S " (upper case S): Look for script using PATH variable. Special meaning in Windows: appends .bat or .cmd if lookup for name fails and name does not have either suffix. " %* " only on WinNT/2K/XP; use %1 %2 . . . %9 on Win9x/DOS ===8<=== I think the simplest way to implement shebang on windows would be embedding one more command line switch with similar functionality to perl's '-x'. -- View this message in context: http://www.nabble.com/Rscript-on-Windows-tf3120774.html#a8651815 Sent from the R devel mailing list archive at Nabble.com. > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Rscript on Windows
I mentioned this twice already and no one answered;however, I am mentioning this a third time since its a serious deficiency. The Rscript facility that is upcoming in R is useful but on Windows one will often be relegated to having two files: a batch file and an R file unless the -x switch is implemented to allow them to be combined. This is not a problem on UNIX which supports #! but on Windows we need -x. Every other common scripting language including perl, python and ruby supports -x for this purpose. (The -x flag would start R processing at the first line that begins with #! so that prior lines could be Windows batch commands allowing the same file to be used as a batch file and an R file.) Note that there is a bug in Windows which means that if you simply associate .R to running R then the result cannot be redirected. There is a bug fix available for this but I think we need to be able to run out of the box for something this common. On 1/29/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Haven't got any feedback on this one. > > Will we be getting a perl/python/ruby style -x switch for Rscript for R 2.5.0? > > It certainly would give more flexibility to users of Rscript on non-UNIX > systems > where #! notation is not available. > > On 1/26/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > > Good idea. ruby seems to work the same way. python does too but with > > a slightly different definition: > > > > C:\> ruby -h | findstr strip > > -x[directory] strip off text before #!ruby line and perhaps cd to > > directory > > > > C:\> perl -h | findstr strip > > -x[directory] strip off text before #!perl line and perhaps cd to > > directory > > > > C:\> python -h | findstr skip > > -x : skip first line of source, allowing use of non-Unix forms of #!cmd > > > > > > On 1/26/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: > > > > > > ActivePerl has '-x' switch which tells it to skip all lines in the file > > > till > > > "#!". > > > This allows writing perl scripts in ordinary .bat files. > > > > > > ?shQuote contains a link with the following perl script example: > > > ===8<=== > > > @echo off > > > :: hello.bat > > > :: Windows executable Perl script > > > :: Note: > > > :: assumes perl.exe is in path > > > :: otherwise, use absolute path > > > perl -x -S "%0" %* > > > goto end > > > #!perl > > > > > > print "Hello, World!\n"; > > > __END__ > > > :end > > > :: -- end of hello.bat -- > > > > > > Windows Notes: > > > " -x " (lower case x): Skip all text until shebang line. > > > " -S " (upper case S): Look for script using PATH variable. Special > > > meaning > > > in Windows: appends .bat or .cmd if lookup for name fails and name does > > > not > > > have either suffix. > > > " %* " only on WinNT/2K/XP; use %1 %2 . . . %9 on Win9x/DOS > > > ===8<=== > > > > > > I think the simplest way to implement shebang on windows would be > > > embedding > > > one more command line switch with similar functionality to perl's '-x'. > > > > > > -- > > > View this message in context: > > > http://www.nabble.com/Rscript-on-Windows-tf3120774.html#a8651815 > > > Sent from the R devel mailing list archive at Nabble.com. > > > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Rscript on Windows
Haven't got any feedback on this one. Will we be getting a perl/python/ruby style -x switch for Rscript for R 2.5.0? It certainly would give more flexibility to users of Rscript on non-UNIX systems where #! notation is not available. On 1/26/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Good idea. ruby seems to work the same way. python does too but with > a slightly different definition: > > C:\> ruby -h | findstr strip > -x[directory] strip off text before #!ruby line and perhaps cd to directory > > C:\> perl -h | findstr strip > -x[directory] strip off text before #!perl line and perhaps cd to directory > > C:\> python -h | findstr skip > -x : skip first line of source, allowing use of non-Unix forms of #!cmd > > > On 1/26/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: > > > > ActivePerl has '-x' switch which tells it to skip all lines in the file till > > "#!". > > This allows writing perl scripts in ordinary .bat files. > > > > ?shQuote contains a link with the following perl script example: > > ===8<=== > > @echo off > > :: hello.bat > > :: Windows executable Perl script > > :: Note: > > :: assumes perl.exe is in path > > :: otherwise, use absolute path > > perl -x -S "%0" %* > > goto end > > #!perl > > > > print "Hello, World!\n"; > > __END__ > > :end > > :: -- end of hello.bat -- > > > > Windows Notes: > > " -x " (lower case x): Skip all text until shebang line. > > " -S " (upper case S): Look for script using PATH variable. Special meaning > > in Windows: appends .bat or .cmd if lookup for name fails and name does not > > have either suffix. > > " %* " only on WinNT/2K/XP; use %1 %2 . . . %9 on Win9x/DOS > > ===8<=== > > > > I think the simplest way to implement shebang on windows would be embedding > > one more command line switch with similar functionality to perl's '-x'. > > > > -- > > View this message in context: > > http://www.nabble.com/Rscript-on-Windows-tf3120774.html#a8651815 > > Sent from the R devel mailing list archive at Nabble.com. > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Rscript on Windows
Good idea. ruby seems to work the same way. python does too but with a slightly different definition: C:\> ruby -h | findstr strip -x[directory] strip off text before #!ruby line and perhaps cd to directory C:\> perl -h | findstr strip -x[directory] strip off text before #!perl line and perhaps cd to directory C:\> python -h | findstr skip -x : skip first line of source, allowing use of non-Unix forms of #!cmd On 1/26/07, Vladimir Eremeev <[EMAIL PROTECTED]> wrote: > > ActivePerl has '-x' switch which tells it to skip all lines in the file till > "#!". > This allows writing perl scripts in ordinary .bat files. > > ?shQuote contains a link with the following perl script example: > ===8<=== > @echo off > :: hello.bat > :: Windows executable Perl script > :: Note: > :: assumes perl.exe is in path > :: otherwise, use absolute path > perl -x -S "%0" %* > goto end > #!perl > > print "Hello, World!\n"; > __END__ > :end > :: -- end of hello.bat -- > > Windows Notes: > " -x " (lower case x): Skip all text until shebang line. > " -S " (upper case S): Look for script using PATH variable. Special meaning > in Windows: appends .bat or .cmd if lookup for name fails and name does not > have either suffix. > " %* " only on WinNT/2K/XP; use %1 %2 . . . %9 on Win9x/DOS > ===8<=== > > I think the simplest way to implement shebang on windows would be embedding > one more command line switch with similar functionality to perl's '-x'. > > -- > View this message in context: > http://www.nabble.com/Rscript-on-Windows-tf3120774.html#a8651815 > Sent from the R devel mailing list archive at Nabble.com. > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Rscript on Windows
ActivePerl has '-x' switch which tells it to skip all lines in the file till "#!". This allows writing perl scripts in ordinary .bat files. ?shQuote contains a link with the following perl script example: ===8<=== @echo off :: hello.bat :: Windows executable Perl script :: Note: :: assumes perl.exe is in path :: otherwise, use absolute path perl -x -S "%0" %* goto end #!perl print "Hello, World!\n"; __END__ :end :: -- end of hello.bat -- Windows Notes: " -x " (lower case x): Skip all text until shebang line. " -S " (upper case S): Look for script using PATH variable. Special meaning in Windows: appends .bat or .cmd if lookup for name fails and name does not have either suffix. " %* " only on WinNT/2K/XP; use %1 %2 . . . %9 on Win9x/DOS ===8<=== I think the simplest way to implement shebang on windows would be embedding one more command line switch with similar functionality to perl's '-x'. -- View this message in context: http://www.nabble.com/Rscript-on-Windows-tf3120774.html#a8651815 Sent from the R devel mailing list archive at Nabble.com. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Rscript on Windows
On UNIX one can use #! notation. It would be nice to be able to do something similar on Windows. This could be done by giving Rscript the capability of skipping over the first few lines. For example, there might be a --skip=n argument or perhaps Rscript would skip over any consecutive leading lines that begin with @ in the R file since that cannot be syntactically correct R but does have meaning to Windows batch, namely, it means do not display the line beginning with @ (but still run it). For example, if we implement the @ idea then a sample 3 line file called grep.bat might look like this: @Rscript grep.bat %1 for(L in grep(commandArgs(TRUE), readLines(file("stdin")), value = TRUE)) cat(L, "\n", sep = "") and then we would run it as a Windows batch file like this from the Windows console to find all lines with the word target: grep target < myfile.txt or if we implemented --skip it might look like this: @Rscript --skip=1 grep.bat %1 for(L in grep(commandArgs(TRUE), readLines(file("stdin")), value = TRUE)) cat(L, "\n", sep = "") __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Rscript on Windows with R 2.5.0 dev
On Windows XP with R version 2.5.0 Under development (unstable) (2007-01-22 r40548) I always get a message about grdevices when I run Rscript, e.g. C:\> rscript NUL During startup - Warning messages: 1: there is no package called 'grdevices' in: library(package, lib.loc = lib.loc , character.only = TRUE, logical = TRUE, 2: package grdevices in options("defaultPackages") was not found __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel