Paul
Paul

Reputation: 505

Add timestamp to R CMD BATCH outfile name

I want to run a script, and name the outfile. The default looks like this:

R CMD BATCH $HOME/test.R $HOME/runoutput/test_

How do I add a timestamp to the name?

Something like this:

R CMD BATCH $HOME/test.R $HOME/runoutput/test_$(date +"%F_%H_%M_%S")

Upvotes: 3

Views: 199

Answers (1)

zx8754
zx8754

Reputation: 56189

Couldn't show backticks in the comments, see below:

R CMD BATCH $HOME/test.R $HOME/runoutput/test_`date +"%F_%H_%M_%S"`

Upvotes: 2

Related Questions