Commit dc2b1ec9 authored by Sebastian Ostberg's avatar Sebastian Ostberg
Browse files

fix regular expressions for experiment command line argument

parent 4cd1417d
...@@ -252,12 +252,12 @@ if (length(commandArgs(trailingOnly = TRUE)) > 0) { ...@@ -252,12 +252,12 @@ if (length(commandArgs(trailingOnly = TRUE)) > 0) {
stop(paste("Invalid parameter sowing_scenario:", sQuote(scen))) stop(paste("Invalid parameter sowing_scenario:", sQuote(scen)))
} }
} }
if (any(grepl("experiment", commandArgs(trailingOnly = TRUE)))) { if (any(grepl("^experiment=", commandArgs(trailingOnly = TRUE)))) {
param <- strsplit( param <- strsplit(
grep("experiment", commandArgs(trailingOnly = TRUE), value = TRUE)[1], grep("^experiment=", commandArgs(trailingOnly = TRUE), value = TRUE)[1],
split = "=" split = "="
) )
exp <- grep("experiment", unlist(param), invert = TRUE, value = TRUE) exp <- grep("^experiment$", unlist(param), invert = TRUE, value = TRUE)
if (nchar(exp) > 0) { if (nchar(exp) > 0) {
print( print(
paste("Parameter experiment provided as command line argument:", exp) paste("Parameter experiment provided as command line argument:", exp)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment