RosettaCodeData/Task/Take-notes-on-the-command-line/R/take-notes-on-the-command-line.r
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

12 lines
312 B
R

#!/usr/bin/env Rscript --default-packages=methods
args <- commandArgs(trailingOnly=TRUE)
if (length(args) == 0) {
conn <- file("notes.txt", 'r')
cat(readLines(conn), sep="\n")
} else {
conn <- file("notes.txt", 'a')
cat(file=conn, date(), "\n\t", paste(args, collapse=" "), "\n", sep="")
}
close(conn)