以下脚本运行报错:command not found,请协助指出,谢谢
#!/bin/bash
read -p "plese input one number:" k
for a in {1,2,3}
do
for b in {1,2,3}
do
for c in {1,2,3}
do
for d in {1,2,3}
do
n=$a*1000+$b*100+$c*10+$d
m=$n%80
if [$m -eq $k];then
if [ $a -eq $c];then
if [$b -eq $d];then
echo $n
fi
fi
fi
done
done
done
done
#!/bin/bash
read -p "plese input one number:" k
for a in {1,2,3}
do
for b in {1,2,3}
do
for c in {1,2,3}
do
for d in {1,2,3}
do
n=$((a*1000+$b*100+$c*10+$d)) #shell中不能直接执行算术运算,要加上$(())
m=$((n%80))
if [ $m -eq $k ];then # [ ]方括号与条件要用空格分开
if [ $a -eq $c ];then
if [ $b -eq $d ];then
echo $n
fi
fi
fi
done
done
done
done
read -p "plese input one number:" k
for a in {1,2,3}
do
for b in {1,2,3}
do
for c in {1,2,3}
do
for d in {1,2,3}
do
n=$((a*1000+$b*100+$c*10+$d)) #shell中不能直接执行算术运算,要加上$(())
m=$((n%80))
if [ $m -eq $k ];then # [ ]方括号与条件要用空格分开
if [ $a -eq $c ];then
if [ $b -eq $d ];then
echo $n
fi
fi
fi
done
done
done
done
温馨提示:答案为网友推荐,仅供参考