how can I pass a parameter to a shell script that is a longer string with spaces and "-"? Here is what I currently have:
/usr/test.sh -g filesystem -q -p "-p \"/usr/\" -s \"some intern string\" -q"
The test.sh script recognizes two -p, two -q and some other things, that are not right. But the value behind the first -p should be one large string: -p "/usr/" -s "some intern string" -q
What is my mistake?
Thanks for any help,
greetings,
Chriss
"${flags[parameter]}"? Once you concatenate a string with spaces into another string with spaces, there's no reliable way to extract the original string.wasteParameter+=("\"$arg\"")if [ $? != 0 ] ; thenwith the error, that it found some not allowed parameter. So there must be a problem withgetoptI guess.