|
|
|
|
|
by colemickens
3462 days ago
|
|
A bit hard to understand your exact scenario here (basically the same shell lexing problem...), but I think this is what you're looking for. I left an example of an argument with a space in there (the last one). PROPS=("-Dprop1=foo" "bar" "-Dprop2=bar foo")
java "${PROPS[@]}" SomeClass.class
(The quotes around `${PROPS[@]}` is important.) Do note, there is an unfortunate edge case here if PROPS is empty, you'll get a false `""` arg passed to java in that case. There's a less pleasant syntax that avoids that issue but I don't recall it off-hand.(edit: Please read the replies to my post, I didn't think about the fact that this syntax is bash specific. Thanks to those who pointed it out) |
|
I tried to find a failsafe solution once while rewriting a daemon script and just gave up.