#!/bin/bash
if [$# -ne 1];
then
echo "/root/script.sh a|b"
else if [$1 ='a'];
then
echo "b"
else if [$1 ='b']; then
echo "a"
else
echo "/root/script.sh a|b"
fi
在Linux上面的脚本运行时出现错误。shell脚本:预期的整数表达式
bar.sh: line 2: [: S#: integer expression expected
a
您能否帮忙移除此错误?
哎,我*希望你没有在root帐户中练习你的shell脚本。 – zwol 2012-07-22 18:35:48
在转录错误信息或代码时,错误信息中的'S#'看起来像拼写错误'$#'。 – tripleee 2012-07-22 19:03:59