【发布时间】:2014-12-24 20:51:36
【问题描述】:
我收到以下错误:
语法错误:文件意外结束。
代码如下:
#!/bin/bash
tput clear
tput bold
echo Hello, what is your name?
read Lol
sleep 2
echo HI $Lol
sleep 3
echo "SoftManager is a software manager and software updater"
sleep 3
echo "Copyright (C) 2014 Winston L"
sleep 2
echo "What would you like to do?"
echo "1. Update"
echo "2. Install/uninstall software"
echo "3. Other awesome tools"
read Pie
if [[ $Pie == 1 ]]; then
echo "What distribution are you running?"
echo "1. Debian, 2. Fedora 3. Arch"
read Interesting
if [[ $Interesting == 1 ]]; then
sudo apt-get update -y
sudo apt-get upgrade -y -qq -f
elif [[ $Interesting == 2 ]]; then
sudo yum install fedora-upgrade
sudo fedora-upgrade
else
sudo pacman-mirrors -g
sudo yaourt -Syua
sudo pacman -Syyu
sudo yaourt -Syua
fi
elif [[ $Pie == 2 ]]; then
echo "Would you like to install or uninstall software?"
echo "1. install, 2. uninstall"
read Hai
if [[ $Hai == 2 ]]; then
echo "What distribution are you running?"
echo "1. Debian, 2. Fedora, 3. Arch"
read Ice
if [[ $Ice == 1 ]]; then
echo "Please type the package you want to uninstall"
read Unin
sudo apt-get remove $Unin
elif [[ $Ice == 2 ]]; then
echo "Please type the package you want to uninstall"
read Pop
sudo yum remove $Pop
else
echo "Please type the package you want to uninstall"
read Ins
sudo pacman -Rns $Ins
fi
elif [[ $Hai == 1 ]]; then
echo "What distribution are you running?"
echo "1. Debian, 2. Fedora, 3. Arch"
read Cake
if [[ $Cake == 1 ]]; then
echo "Please type the package you want to install"
read Igloo
sudo apt-get install $Igloo
elif [[ $Cake == 2 ]]; then
echo "Please type the package you want to install"
read Test
yum install $Test
else
echo "Please type the package you want to install"
read Amaze
yaourt $Amaze
fi
else
echo "Invalid option"
fi
else
echo "Please choose one of these tools:"
echo "1. Download file from Internet"
echo "2. Add ppa"
read Pirate
if [[ $Pirate == 1 ]]; then
echo "Please type the link, note that the file will be downloaded to where this script is"
read Haha
wget $Haha
elif [[ $Pirate == 2 ]]; then
echo "Please type the ppa:"
read Randomis
sudo add-apt repository $Randomis
else
echo "Invalid option"
fi
【问题讨论】: