解决 cg1.sh 脚本错误: line 61: syntax error: unexpected end of file
cg1.sh 脚本出现“line 61: syntax error: unexpected end of file”错误,通常是由于缺少 "esac" 语句导致的。这个错误提示表明在脚本的第 61 行,解释器遇到了一个意外的文件结尾,这意味着它在预期的 "esac" 语句之前就结束了。
错误原因:
该错误通常是由于在 case 语句中缺少结束语句 esac 引起的。脚本中嵌套了多个 case 语句,如果没有正确地关闭每个 case 语句,就会出现此错误。
解决方法:
在 case 语句结束的位置添加 esac 语句。
示例代码:
case ${1} in
-h|--help)
echo 1
hcjx
;;
*)
case $(uname -o) in
Android)
validity
variable
self_install whiptail pkg
self_install pv pkg
self_install wget pkg
self_install git pkg
self_install jq pkg
self_install curl pkg
self_install bc pkg
self_install language-pack-zh-hans pkg
open=($
whiptail --title '选择功能' --menu 'termux按自己需求来' 15 60 4 \
'1' 'proot' \
'2' '待添加' \
'0' '退出' 3>&1 1>&2 2>&3
)
case $open in
1)
open=($
whiptail --title '选择功能' --menu 'termux按自己需求来' 15 60 4 \
'1' '安装proot' \
'2' '启动proot' \
'3' '删除proot' \
'0' '退出' 3>&1 1>&2 2>&3
)
case $open in
1)
Download_proot_os
;;
2)
start_proot
;;
3)
echo -e "$(gettime)${RED}Ctrl + C 终止删除 回车确定执行"
hcjx
rm -rfv ${HOME}/.gancm/proot/${os_name}/
;;
0)
return 0
;;
esac
;;
esac
;;
*)
echo "$(gettime)待添加"
;;
esac # Add this line
esac # Add this line
注意:
- 确保在每个
case语句的末尾添加esac语句,以正确结束case语句。 - 仔细检查脚本中的其他语法错误。
原文地址: https://www.cveoy.top/t/topic/pfRt 著作权归作者所有。请勿转载和采集!