Try this one line R script: print(sub(".*=", "", commandArgs()[4]))
Also see the geopt package for fancier handling of arguments. On Tue, Sep 22, 2009 at 11:47 AM, Peng Yu <pengyu...@gmail.com> wrote: > Hi, > > Right now, I hardcode the file name in the script. But when I change > the script name, I have to change the file name in the script to make > sure the file name inside the script is synchronized with the script > name. I am wondering if there is an automatic way to get the script > file name in a script. > > Regards, > Peng > > $ Rscript get_file_name.R >> print('get_file_name.R') > [1] "get_file_name.R" >> > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.