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.
Tell me more
×
Server Fault is a question and answer site for
professional system and network administrators. It's 100% free, no registration required.
|
|
|||||
|
You will have troubles with paths with spaces, using |
|||
|
|
|
use bash arrays
|
|||||||
|