文件删除过程失败,并带有初始if else方法,并继续显示相同的错误,如“参数过多” 感谢您的帮助
if [ "$year" -a -eq -d "${var:0:4}" ]; then
dir = "$folder/$subfolder/$sub/$sub"
if [ "$month" -a -ge -d "${var:4}" ]; then
command $dir
fi
elif [ "$year" -a -gt -d "${var:0:4}" ]; then
command $dir
else
echo "NOT VALID"
fi
答案 0 :(得分:0)
删除不必要的标志。
if [ "$year" -eq "${var:0:4}" ]; then
dir = "$folder/$subfolder/$sub/$sub"
if [ "$month" -ge "${var:4}" ]; then
command $dir
fi
elif [ "$year" -gt "${var:0:4}" ]; then
command $dir
else
echo "NOT VALID"
fi