./startserver.sh: line 58: unexpected EOF while looking for matching ./startserver.sh: line 61: syntax error: unexpected end of file?
Ich habe das Problem ich finde nicht den Fehler könnte mir jemand helfen bin erst anfänger.
Will einen Minecraft Serverstarter machen.
#!/bin/bash
if [ -f craftbukkit-1.16.5.jar ]; then
echo "Skipping download. Using existing craftbukkit-1.16.5.jar"
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar
if [[ $DO_RAMDISK -eq 1 ]]; then
sudo umount $SAVE_DIR
rm -rf $SAVE_DIR
mv "${SAVE_DIR}_backup" $SAVE_DIR
fi
else
export URL="https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.16.5.jar"
fi
echo $URL
which wget >> /dev/null
if [ $? -eq 0 ]; then
echo "DEBUG: (wget) Downloading ${URL}"
wget -O craftbukkit-1.16.5.jar "${URL}"
else
which curl >> /dev/null
if [ $? -eq 0 ]; then
echo "DEBUG: (curl) Downloading ${URL}"
curl -o craftbukkit-1.16.5.jar "${URL}"
else
echo "Neither wget or curl were found on your system. Please install one and try again"
fi
fi
if egrep -q eula=true eula.txt; then
echo Starting ...
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
exit
else
Height=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="Bukkit"
TITLE="Choice"
MENU="Do you accet the eula at (https://account.mojang.com/documents/minecraft_eula) ? "
OPTIONS=(1 "Yes
2 "No")
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \ --menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
echo "You accepted the eula..."
sed s/false/true/g eula.txt
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
;;
2)
echo "You not Accepted the eula"
;;
fi
3 Antworten
#!/bin/bash
if [ -f craftbukkit-1.16.5.jar ]; then
echo "Skipping download. Using existing craftbukkit-1.16.5.jar"
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar
if [[ $DO_RAMDISK -eq 1 ]]; then
sudo umount $SAVE_DIR
rm -rf $SAVE_DIR
mv "${SAVE_DIR}_backup" $SAVE_DIR
fi
else
export URL="https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.16.5.jar"
fi
echo $URL
which wget >> /dev/null
if [ $? -eq 0 ]; then
echo "DEBUG: (wget) Downloading ${URL}"
wget -O craftbukkit-1.16.5.jar "${URL}"
else
which curl >> /dev/null
if [ $? -eq 0 ]; then
echo "DEBUG: (curl) Downloading ${URL}"
curl -o craftbukkit-1.16.5.jar "${URL}"
else
echo "Neither wget or curl were found on your system. Please install one and try again"
fi
fi
if egrep -q eula=true eula.txt; then
echo Starting ...
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
exit
else
Height=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="Bukkit"
TITLE="Choice"
MENU="Do you accet the eula at (https://account.mojang.com/documents/minecraft_eula) ? "
OPTIONS=(1 "Yes"
2 "No")
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \ --menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
echo "You accepted the eula..."
sed s/false/true/g eula.txt
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
;;
2)
echo "You not Accepted the eula"
;;
esac
fi
Auch wenn ich 'esac' hinzufüge kommt "./startserver.sh: line 58: unexpected EOF while looking for matching `"'
./startserver.sh: line 62: syntax error: unexpected end of file".
Wenn ich das richtig verstehe soll ich dass so machen:
case $CHOICE in
#1)
echo "You accepted the eula..."
sed s/false/true/g eula.txt
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
;;
#2)
echo "You not Accepted the eula"
;;
esac
Nein, den ganzen Part, also so:
# case $CHOICE in
# 1)
# echo "You accepted the eula..."
# sed s/false/true/g eula.txt
# java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
# ;;
# 2)
# echo "You not Accepted the eula"
# ;;
# esac
echo $CHOICE
Oder besser noch am Ende:
echo "Der Wert der Variable lautet: "$CHOICE
Dann weißt du auch, woher der Wert in der Ausgabe kommt.
Nein es kommt immer noch das Syntax Error
./startserver.sh: line 54: unexpected EOF while looking for matching `"'
./startserver.sh: line 59: syntax error: unexpected end of file
Stimmt, durch das elif ist jetzt noch ein fi zu viel drin. Setze bitte dort auch nochmal ein #
if which wget > /dev/null
echo "DEBUG: (wget) Downloading ${URL}"
wget -O craftbukkit-1.16.5.jar "${URL}"
elif which curl > /dev/null
echo "DEBUG: (curl) Downloading ${URL}"
curl -o craftbukkit-1.16.5.jar "${URL}"
else
echo "Neither wget or curl were found on your system. Please install one and try again"
# fi
fi
Es kommt trotzdem unexpected end of file
./startserver.sh: line 55: unexpected EOF while looking for matching `"'
./startserver.sh: line 60: syntax error: unexpected end of file
Irgendwas hast du im letzten Kommentar noch nachträglich geändert. Vorher stand da etwas mit »line 24«.
So wird es schwierig, dir zu helfen.
Hier noch mal den ganzen Script und Debug
#!/bin/bash
if [ -f craftbukkit-1.16.5.jar ]; then
echo "Skipping download. Using existing craftbukkit-1.16.5.jar"
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar
if [[ $DO_RAMDISK -eq 1 ]]; then
sudo umount $SAVE_DIR
rm -rf $SAVE_DIR
mv "${SAVE_DIR}_backup" $SAVE_DIR
fi
else
export URL="https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.16.5.jar"
fi
echo $URL
if which wget > /dev/null; then
echo "DEBUG: (wget) Downloading ${URL}"
wget -O craftbukkit-1.16.5.jar "${URL}"
elif which curl > /dev/null; then
echo "DEBUG: (curl) Downloading ${URL}"
curl -o craftbukkit-1.16.5.jar "${URL}"
else
echo "Neither wget or curl were found on your system. Please install one and try again"
# fi
fi
if egrep -q eula=true eula.txt; then
echo Starting ...
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
exit
else
Height=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="Bukkit"
TITLE="Choice"
MENU="Do you accet the eula at (https://account.mojang.com/documents/minecraft_eula) ? "
OPTIONS=(1 "Yes
2 "No")
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
# case $CHOICE in
# 1)
# echo "You accepted the eula..."
# sed s/false/true/g eula.txt
# java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
# ;;
# 2)
# echo "You not Accepted the eula"
# ;;
# esac
echo $CHOICE
fi
----------------------------------------------------------------------------
Skipping download. Using existing craftbukkit-1.16.5.jar
*** Error, this build is outdated ***
*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***
*** Server will start in 20 seconds ***
Loading libraries, please wait...
[23:15:45] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
DEBUG: (wget) Downloading
http://: Invalid host name.
./startserver.sh: line 55: unexpected EOF while looking for matching `"'
./startserver.sh: line 60: syntax error: unexpected end of file
Habe Line 24 selber gelöst und hab es vergessen es hin zu schreiben
Hmm, die Fehlermeldungen ergeben für mich im Moment keinen Sinn. Das # am Anfang bedeutet, dass die entsprechend gekennzeichnete Zeile bei der Ausführung ignoriert werden soll.
Zeile 55 lautet:
# sed s/false/true/g eula.txt
Zeile 60 lautet:
# ;;
Steht da zwischendrin noch irgendetwas anderes in deinem Skript?
nein ich habe copy and paste gemacht
hier nochmal :
#!/bin/bash
if [ -f craftbukkit-1.16.5.jar ]; then
echo "Skipping download. Using existing craftbukkit-1.16.5.jar"
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar
if [[ $DO_RAMDISK -eq 1 ]]; then
sudo umount $SAVE_DIR
rm -rf $SAVE_DIR
mv "${SAVE_DIR}_backup" $SAVE_DIR
fi
else
export URL="https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.16.5.jar"
fi
echo $URL
if which wget > /dev/null; then
echo "DEBUG: (wget) Downloading ${URL}"
wget -O craftbukkit-1.16.5.jar "${URL}"
elif which curl > /dev/null; then
echo "DEBUG: (curl) Downloading ${URL}"
curl -o craftbukkit-1.16.5.jar "${URL}"
else
echo "Neither wget or curl were found on your system. Please install one and try again"
# fi
fi
if egrep -q eula=true eula.txt; then
echo Starting ...
java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
exit
else
Height=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="Bukkit"
TITLE="Choice"
MENU="Do you accet the eula at (https://account.mojang.com/documents/minecraft_eula) ? "
OPTIONS=(1 "Yes
2 "No")
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
# case $CHOICE in
# 1)
# echo "You accepted the eula..."
# sed s/false/true/g eula.txt
# java -Xmx5G -Xms5G -jar craftbukkit-1.16.5.jar nogui
# ;;
# 2)
# echo "You not Accepted the eula"
# ;;
# esac
echo $CHOICE
fi
----------------------------------------------------------------------------
https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.16.5.jar
DEBUG: (wget) Downloading https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.16.5.jar
--2021-03-13 23:34:28-- https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.16.5.jar
Resolving cdn.getbukkit.org (cdn.getbukkit.org)... 149.28.57.95
Connecting to cdn.getbukkit.org (cdn.getbukkit.org)|149.28.57.95|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 35571609 (34M) [application/java-archive]
Saving to: ‘craftbukkit-1.16.5.jar’
craftbukkit-1.16.5.jar 100%[=================================================>] 33.92M 5.68MB/s in 6.4s
2021-03-13 23:34:35 (5.27 MB/s) - ‘craftbukkit-1.16.5.jar’ saved [35571609/35571609]
./startserver.sh: line 56: unexpected EOF while looking for matching `"'
./startserver.sh: line 61: syntax error: unexpected end of file
Dann komme ich im Moment auch nicht weiter. Vielleicht findet sich ja noch jemand mit mehr Erfahrung, der sich das erklären kann. Gerade über diese beiden Zeilen dürfte das Skript eigentlich nicht stolpern.
Vor allem, dass sich die Zeilennummern nach einem weiteren Durchlauf noch ändern, ist mir ein Rätsel. Normalerweise müssten die immer gleich sein.
Weiterer Verbesserungsvorschlag: statt
which wget >> /dev/null
if [ $? -eq 0 ]; then
schreibst du
if which wget > /dev/null; then
und statt
else
which curl >> /dev/null
if [ $? -eq 0 ]; then
schreibst du
elif which curl > /dev/null; then
Genauso, wie du jede if-Anweisung mit fi abschließen musst, musst du auch jede case-Anweisung mit esac abschließen.
Letzteres fehlt in deinem Skript.
Dann schau dir auch noch die Zeilen
OPTIONS=(1 "Yes
2 "No")
an. Wenn ich das richtig sehe, fehlt hinter dem Yes noch ein abschließendes Quote.
Also ich bin ja schon wie oben gesagt kein Profi und weiß auch nicht was Quotes sind
Vor dem letzten fi, da die case-Anweisung wohl logisch noch mit in die if-Anweisung gehört.
Zur ersten Fehlermeldung: dann stimmt wohl etwas mit der Zeile
noch nicht. Den Befehl kenne ich allerdings auch nicht so genau. Etwas unklar ist mir derzeit auch noch, was genau du der Variable CHOICE da zuweist. Du machst da irgend etwas mit einem Dialog; aber bist du sicher, dass am Ende wirklich nur 1 oder 2 herauskommt?
Das könntest du ausprobieren, indem du vor jeder Zeile des case ... esac-Parts ein # setzt und dir die Variable dann oberhalb dieses Teils mit
ausgeben lässt.