[CentOS] creating RPMs from CRAN tarballs

Fri Jun 5 23:20:05 UTC 2015
Peter <peter at pajamian.dhs.org>

On 06/06/2015 03:21 AM, Nicolas Thierry-Mieg wrote:
>>> perl -pi -e 's:^#!/usr/bin/r:#!/usr/bin/R: unless $i++'
>>> path/to/R/scripts/*.R
>>
>> I assume the "unless $i++" is supposed to limit the replace operation to
>> only the first line each file.  Unfortunately, since it is a global
>> variable, it is actually limiting it to only the first line of the first
>> file.

Yeah, it was untested code off the top of my head and you are correct.

> just replace it everywhere, /usr/bin/r doesn't exist anyways, but make
> sure there's nothing after the r:
> perl -pi -e 's:^#!/usr/bin/r\s*$:#!/usr/bin/R:' whatever/*.R

This should work.


Peter