#!/bin/sh
echo Enter choice :
echo a : To create a file, name given by user.
echo b : To copy file to another location.
echo c : To determine minimum age to vote.
read choice
case $choice in
a) echo Enter the name of file.
read name
mkdir $name ;;
b) echo Enter file name you want to copy
read file_name
echo Enter location where you want to copy $file_name
read location
cp -r $file_name "$location";;
c) echo Enter age :
read age
if [ age -ge 18 ]
then
echo You are eligible
else
echo You are not eligible
"fi"
;;
*) echo Please! Enter correct choice.
esac
在这一点上,我选择了选项c,但它显示了我无法解决的错误。
错误:
Enter choice :
a : To create a file, name given by user.
b : To copy file to another location.
c : To determine minimum age to vote.
c
./a.sh: 27: Syntax error: ";;" unexpected (expecting "fi")
1条答案
按热度按时间rks48beu1#
帮助修复您的代码,您可以比较您的代码作为参考