我有一个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
引发错误。我该怎么做才能让它接受字符串
答案 0 :(得分:2)
您的elif
行中缺少空格:
elif [ "$zone" == "B" ]; then