Reputation: 7074
I need to pass array as argument to my app. It's array of colors in hsl notation so values look like "hsl(123,20%,30%)","hsl(94,30%,30%)"
. Because of that separating elements with ,
doesn't seem to be convenient here. What are other notations? If i remember well Java was using :
as list delimeter. Is it widely used notation?
Upvotes: 2
Views: 79
Reputation: 30823
A (POSIX) shell doesn't really care that much about the arguments you pass to your program. The only issue here is that you need to quote them because you are using parenthesis which the shell doesn't like unquoted, except when part of some syntaxic construction.
Whether you want to use a comma, a colon or whatever is then unrelated to the shell but to the way your application is parsing its parameters. Having commas both as component delimiters and array element delimiters is not that difficult for a parser to handle but a different punctuation will simplify it. I might have used a semicolon here still assuming the argument is quoted.
Another approach would be to pass each color as a separate argument, i.e. use a space character as separator. This would be simple to handle if that array need not to be followed by other arguments.
Upvotes: 1