Você está perdendo uma instrução fi
para fechar a primeira condicional if
/ then
/ else
.
Eu tenho um pedaço de código que tem alguns problemas sérios e eu esperava resolvê-lo em breve, mas ninguém ofereceu ajuda. Eu pensei em experimentar alguns usuários do Ubuntu, já que este é o sistema operacional que executa o script.
mc_addplugin() {
if pgrep -u $USERNAME -f $SERVICE > /dev/null
then
echo "$SERVICE is running! Please stop the service before adding a plugin."
else
echo "Paste the URL to the .JAR Plugin..."
read JARURL
JARNAME=$(basename "$JARURL")
if [ -d "$TEMPPLUGINS" ]
then
as_user "cd $PLUGINSPATH && wget -r -A.jar $JARURL -o temp_plugins/$JARNAME"
else
as_user "cd $PLUGINSPATH && mkdir $TEMPPLUGINS && wget -r -A.jar $JARURL -o temp_plugins/$JARNAME"
fi
if [ -f "$TMPDIR/$JARNAME" ]
then
if [ -f "$PLUGINSPATH/$JARNAME" ]
then
if 'diff $PLUGINSPATH/$JARNAME $TMPDIR/$JARNAME >/dev/null'
then
echo "You are already running the latest version of $JARNAME."
else
NOW='date "+%Y-%m-%d_%Hh%M"'
echo "Are you sure you want to overwrite this plugin? [Y/n]"
echo "Note: Your old plugin will be moved to the "$TEMPPLUGINS" folder with todays date."
select yn in "Yes" "No"; do
case $yn in
Yes ) as_user "mv $PLUGINSPATH/$JARNAME $TEMPPLUGINS/${JARNAME}_${NOW} && mv $TEMPPLUGINS/$JARNAME $PLUGINSPATH/$JARNAME"; break;;
No ) echo "The plugin has not been installed! Removing temporary plugin and exiting..."
as_user "rm $TEMPPLUGINS/$JARNAME"; exit;;
esac
done
echo "Would you like to start the $SERVICE now? [Y/n]"
select yn in "Yes" "No"; do
case $yn in
Yes ) mc_start; break;;
No ) "$SERVICE not running! To start the service run: /etc/init.d/craftbukkit start"; exit;;
esac
done
fi
else
echo "Are you sure you want to add this new plugin? [Y/n]"
select yn in "Yes" "No"; do
case $yn in
Yes ) as_user "mv $PLUGINSPATH/$JARNAME $TEMPPLUGINS/${JARNAME}_${NOW} && mv $TEMPPLUGINS/$JARNAME $PLUGINSPATH/$JARNAME"; break;;
No ) echo "The plugin has not been installed! Removing temporary plugin and exiting..."
as_user "rm $TEMPPLUGINS/$JARNAME"; exit;;
esac
done
echo "Would you like to start the $SERVICE now? [Y/n]?"
select yn in "Yes" "No"; do
case $yn in
Yes ) mc_start; break;;
No ) "$SERVICE not running! To start the service run: /etc/init.d/craftbukkit start"; exit;;
esac
done
fi
else
echo "Failed to download the plugin from the URL you specified!"
exit;
fi
}
Ele lança no colchete final no final da função.
Você está perdendo uma instrução fi
para fechar a primeira condicional if
/ then
/ else
.