Unix shell脚本返回代码错误与for循环

时间:2016-01-15 09:08:13

标签: shell unix scripting

我陷入了一个脚本,它有一个if循环和一个for循环,PFB代码我在行中得到语法错误:`(('意外

 if [ $? = 0 ]; then
 for (( count=0; count<=number; count++ ))
    echo " statement"
done

else 
 echo " Else statement executed "
fi

任何人都可以帮我这个......?

1 个答案:

答案 0 :(得分:0)

您缺少完成 fi

#!/bin/bash
number=4
if [ $? = 0 ]; then  
  for (( count=0; count<=number; count++ ))
  do
      echo "df"
  done
fi