1

我有一个bash脚本如下,

#!/bin/bash
zone=$1
if  [ "$zone" == "A" ]; then
    pdsh -l abc -w server[01-12] 'sudo abc stop'
elif ["$zone" == "B" ]; then
    pdsh -l abc -w server[1-12].abc.def.com 'sudo abc stop'
fi

服务器字符串.abc.def.com引发错误。我该怎么做才能让它接受字符串

4

1 回答 1

2

您的elif行中缺少一个空格:

elif [ "$zone" == "B" ]; then
于 2012-08-22T08:35:34.023 回答