Not selected, it can be simple:
exec unison -path $1 -path $2 -path $3
If you do not insert spaces in the names of your paths, you can deal with a variable number of arguments with:
arglist="" for path in " $@ " do arglist="$arglist -path $path" done exec unison $arglist
If you have spaces in the path names, you will have to work a lot harder; I usually use a user program called escape , which quotes arguments that require quotation marks, and eval :
arglist="" for path in " $@ " do path=$(escape "$path") arglist="$arglist -path $path" done eval exec unison "$arglist"
I note that using Perl or Python would make it easier to handle arguments with spaces in them, but the question asks about the shell.
In Bash, you can use a shell array variable - create arguments in the array and pass the array as arguments to the unison .
source share