I have a variable with space separated list of paths. I need to send these paths to a program as a parameter like this script.sh -i /dir1 -i /dir2. What is the best way to create such parameter list? Something like $(echo "$paths" | sed 's|\([^[:space:]]\+\)|-i \1|g) will work but it's unreadable given the fact that it's part of the makefile.
| |||||
feedback
|
You will have troubles with paths with spaces, using | |||
|
feedback
|
|
use bash arrays
| |||||||
feedback
|