run unison in bash script
Hi when I run a command on terminal like that
unison dir1 dir2 -ignore 'Regex dir3' -batch -force dir1 -confirmbigdel=false
it runs normally. But when I try to run it in a bash script it like that
a="-ignore 'Regex dir3'"
unison dir1 dir2 "$a" -batch -force dir1 -confirmbigdel=false
it says that
开发者_Go百科unison: unknown option `-ignore 'Regex c''
How can I solve that problem? Thank you... .
You need to use an array instead of a string. That way, when you "dereference", the shell will see the right number of words (2).
a=( -ignore 'Regex dir3' )
unison dir1 dir2 "${a[@]}" -batch -force dir1 -confirmbigdel=false
精彩评论