
-if [[ "$host_ibmc_ip" =~ ^[0-9]+.* ]]; then +if [[ "$host_ibmc_ip" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then echo ">>> exec ipmitool commamd!" ipmitool -I lanplus -H $host_ibmc_ip -U $iBMC_user -P $iBMC_passwd power reset - [ $? -eq 0 ] && echo "succeed!"
+ [ $? -eq 0 ] && echo "reboot $host_name succeed!" || \ + "echo reboot $host_name failed!"
That looks awkward. - don't mix && || in same line - "echo => echo " ?
else - echo "specify host cannot found0!" + echo "specify host cannot found!"
Please carry the relevant variable in error message.
+ echo "host_ibmc_ip not valid: $host_ibmc_ip"
Dewan, would you go through out code base and fix more that kind of cases, for easier debugging error messages? Please do it step by step. Thanks, Fengguang