我正在尝试在我的 shell 脚本中定义数组,其内容如下
cassandra_hosts=(cassandra1.test-dev.local cassandra2.test-dev.local cassandra3.test-dev.local)
但它不允许我定义它并给出如下错误。
-bash: syntax error near unexpected token `cassandra1.test-dev.local'
我尝试了以下组合来定义它,但它们不起作用。
cassandra-hosts=('cassandra1.test-dev.local' 'cassandra2.test-dev.local' 'cassandra3.test-dev.local')
cassandra-hosts=("cassandra1.test-dev.local" "cassandra2.test-dev.local" "cassandra3.test-dev.local")
cassandra-hosts=(cassandra1\.test-dev\.local cassandra2\.test-dev\.local cassandra3\.test-dev\.local)
cassandra-hosts=('cassandra1\.test-dev\.local' 'cassandra2\.test-dev\.local' 'cassandra3\.test-dev\.local')
cassandra-hosts=("cassandra1\.test-dev\.local" "cassandra2\.test-dev\.local" "cassandra3\.test-dev\.local")
cassandra-hosts=("cassandra1\.test-dev\.local" "cassandra2\.test-dev\.local" "cassandra3\.test-dev\.local")
cassandra-hosts=('cassandra1\.test-dev\.local' 'cassandra2\.test-dev\.local' 'cassandra3\.test-dev\.local')
我究竟做错了什么?
1 个回答