我正在尝试比较交换机型号(例如:2620-48-PWR,2848,5308xl,5412zl),因此我可以针对特定型号运行特定测试。当我运行脚本时,我收到错误:
tstVOIPConfigTest.bsh:第207行:5412zl:算术语法错误
但是这个页面:(http://www.softpanorama.org/Scripting/Shellorama/arithmetic_expressions.shtml)表示“Bash只是忽略任何不包含数值的字符串而会为包含数字和其他字符的任何内容生成错误: “
示例代码:
if [[ $switchModel -eq "2810-48G" ]]; then
echo "2810-48g Series Switch detected - verifying if qos-passthrough-mode is enabled" >> $errFile
test "qos-passthrough-mode typical" "qos-passthrough-mode typical set" "qos-passthrough-mode typical not set"
fi
由于我的脚本是用bash编写的,我的问题是如何在bash本身(据我所知)不能满足我需要的时候完成我需要做的事情?
提前谢谢你,
答案 0 :(得分:5)