Novo no unix precisa de ajuda com script

4

Estou trabalhando em um script, mas continuo recebendo este erro Erro de sintaxe: ")" inesperado (esperando ";;")

aqui está o script

#!/bin/sh
#Name:gamer
#Date Created: 12/6/2015
#last modified: 12/8/2015
#Desc/Purpose: Updating and installing apps.
DATE=$(date -d "" +"%m_%d_%Y");
condition=y
while [ $condition = "y" ] || [ $condition = "Y" ]
do

clear

echo -n "Do you know how to Update OS"
read answer

if [ $answer = "y" ] || [ $answer = "Y" ]; then
    echo "Good update the os then."

elif [ $answer = "n" ]; then
    echo "would you like me to update it for you"
    read response
    if  [ $response = "y" ]; then
        echo "updating os!"
            sudo apt-get update os
clear
echo -n "which app would you like to install"
read answer

if [ $answer = "y" ] || [ $answer = "Y" ]; then
        echo "A) Install Webmin"
        echo "B) Install Apache"
        echo "C) Install gnome shell"
        echo "D) get ubuntu desktop"
        echo "E) Add new user"
        echo "F) get Xubuntu Desktop"
        echo "G) Install openbox"
        echo "H) remove Libre office"
        echo "I) I don't want to install anything"
        read option

        case $option in 
            A) sudo apt-get install webmin ;;
            B) sudo apt-get install apache ;;
            C) sudo apt-get install gnome-shell ;;
            D) sudo apt-get install ubuntu-desktop ;;
            E) sudo useradd ;;
            F) sudo apt-get install xubuntu-desktop ;;
            G) sudo apt-get install openbox ;;
            H) sudo apt-get remove --purge libreoffice* ;;
            I) echo "You can always do it later"
            *) echo "Please select one of the options"


done

Toda ajuda é apreciada, obrigado.

    
por Gamer 09.12.2015 / 03:34

1 resposta

2

O correto:

#!/bin/sh
#Name:gamer
#Date Created: 12/6/2015
#last modified: 12/8/2015
#Desc/Purpose: Updating and installing apps.
DATE=$(date -d "" +"%m_%d_%Y");
condition=y
while [ $condition = "y" ] || [ $condition = "Y" ]
do

clear

echo -n "Do you know how to Update OS"
read answer

if [ $answer = "y" ] || [ $answer = "Y" ]; then
    echo "Good update the os then."

elif [ $answer = "n" ]; then
    echo "would you like me to update it for you"
    read response
    if  [ $response = "y" ]; then
        echo "updating os!"
            sudo apt-get update os
    fi
fi
clear
echo -n "which app would you like to install"
read answer

if [ $answer = "y" ] || [ $answer = "Y" ]; then
        echo "A) Install Webmin"
        echo "B) Install Apache"
        echo "C) Install gnome shell"
        echo "D) get ubuntu desktop"
        echo "E) Add new user"
        echo "F) get Xubuntu Desktop"
        echo "G) Install openbox"
        echo "H) remove Libre office"
        echo "I) I don't want to install anything"
        read option

        case $option in 
            A) sudo apt-get install webmin ;;
            B) sudo apt-get install apache ;;
            C) sudo apt-get install gnome-shell ;;
            D) sudo apt-get install ubuntu-desktop ;;
            E) sudo useradd ;;
            F) sudo apt-get install xubuntu-desktop ;;
            G) sudo apt-get install openbox ;;
            H) sudo apt-get remove --purge libreoffice* ;;
            I) echo "You can always do it later" ;;
            *) echo "Please select one of the options" ;;
        sac
fi
done
    
por Tung Tran 09.12.2015 / 04:05