bash - 如何在bash中逐行执行if语句
问题描述
如何在bash中逐行执行if语句?
for i in $(cat $install_script)
do
if [ "$i" = "$check" ]; then
count=$((count+1))
echo whiptail --title "Install SmartBoard" --yesno "${scripts_name[$count]}" 7 $((${#scripts_name[$count]} + 5))
if (( $? == 0 )); then
skip=false
else
skip=true
fi
fi
if [ "$i" == "$check wifi" ]; then
break
fi
if [ $skip == true ]; then
continue
else
sh -c $i ## process line by line
fi
done
错误 !!
sh: 1: Syntax error: end of file unexpected (expecting "then")
sh: 1: Syntax error: "then" unexpected
sh: 1: Syntax error: "else" unexpected
sh: 1: Syntax error: "fi" unexpected
我英语不好,所以如果我的帖子很粗鲁,对不起。:(
解决方案
推荐阅读
- javascript - 时刻js时间格式没有产生正确的时间
- java - kotlin编译器找不到生成的java源代码
- javascript - 我可以做一些完全一样的东西吗和
- python - 使用 nodejs 请求 nasdaq.com 失败但使用 python
- c# - 尝试在我的 Xamarin 应用程序中创建计数器
- javascript - Date() 对象上是否有消除日间节省的方法?
- html - 使用 Selenium Webdriver Python 从表中获取链接、月份和日期,但获取 web 元素没有属性 len()
- python - 如何使用 beautifulsoup 和 pandas 从带有日期过滤器的数据框中抓取数据?
- django - 如何在代码中为权限创建用户组(不在管理员中)
- javascript - 当每个元素都有一个单独的提交按钮时,提交列表中单个元素的正确方法是什么