Isn't 'source' a csh (tcsh, etc.) command? The sh (bash, etc.) command is a period, but you probably will need to use sh constructs in the file (like VAR=value;exportVAR) instead of csh constructs (like setenv VAR value).
Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Dec 20, 2018 at 7:00 AM Agustin Lobo <aloboa...@gmail.com> wrote: > Hi! > I quite often use system() to run other programs from within R, but > have just hitted > a problem: > > For a given program, I need to set up its environment, which I normally do > with > source /home/alobo/OTB-6.6.0-Linux64/otbenv.profile > from the terminal. > Now, when I try to do the same from within R, I get: > > > system("source /home/alobo/OTB-6.6.0-Linux64/otbenv.profile", > intern=TRUE) > sh: 1: source: not found > Error in system("source /home/alobo/OTB-6.6.0-Linux64/otbenv.profile", : > error in running command > > I need this command to set the environment before I actually run the > program. My idea was saving a simple script from within R in which > the first line would be > source /home/alobo/OTB-6.6.0-Linux64/otbenv.profile > > and then run the script with system(), but I get that odd error with > source. I thought source was just > a plain linux command, how can it be "not found" from within system()? > > Any help much appreciated, > Thanks > > > -- > Agustin Lobo > aloboa...@gmail.com > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.