/ / बैश कमांड कोटिंग इश्यू - बैश, कोटिंग

बैश कमांड मुद्दे उद्धृत - बैश, उद्धरण

मेरे पास यह अजीब मुद्दा है, मैं समझ सकता हूं कि क्यों हो रहा है। यह किसी भी बैश निंजा के लिए केक का एक टुकड़ा होना चाहिए।

OPTIONS="-auto -batch -ignore "Path one" -ignore "Path two" -ignore "Path three""
unison $OPTIONS a b

मुझे उम्मीद है कि इसका अनुवाद किया जाएगा ...

unison -auto -batch -ignore "Path one" -ignore "Path two" -ignore "Path three" a b

... और सिर्फ काम। लेकिन यह "t" नहीं है। जब पूर्ण कमांड चलाते हैं, तो मुझे कोई समस्या नहीं है, इसके साथ एकसमान ठीक है। लेकिन जब मैं कमांड चलाता हूं। unison $OPTIONS a b, एकसमान शिकायतें:

Usage: unison [options]
or unison root1 root2 [options]
or unison profilename [options]

For a list of options, type "unison -help".
For a tutorial on basic usage, type "unison -doc tutorial".
For other documentation, type "unison -doc topics".

unison was invoked incorrectly (too many roots)

मैं क्या गलत कर रहा हूं?

उत्तर:

उत्तर № 1 के लिए 6

BASH FAQ प्रविष्टि # 50: "मैं एक चर में एक कमांड डालने की कोशिश कर रहा हूं, लेकिन जटिल मामले हमेशा विफल होते हैं!"

options=(-auto -batch -ignore "Path one" ...)
unison "${options[@]}" a b