我正在尝试编写 .sh 但出现错误:
这是一个 minecraftserver 更新程序(仅供参考)
代码:
#!/bin/sh
# Deleting Old Files
if [ -e spigot1.jar]; then
rm spigot1.jar
fi
# Renaming
if [ -e spigot.jar]; then
echo Renaming File...
mv spigot.jar spigot1.jar
echo Done.
echo
else
echo
fi
# Downloading
echo Downloading File...
wget http://ci.md-5.net/job/Spigot/lastBuild/artifact/Spigot-Server/target/spigot.jar
echo Done.
# Comparing Files
echo
echo Testing if the files are the same...
if diff -a -w spigot.jar spigot1.jar >/dev/null ; then
echo Done.
echo
echo -----------------------------------
echo
echo You already have the newest version!
echo
echo -----------------------------------
else
echo Done.
echo
echo -----------------------------------
echo
echo Updated to a newer version!
echo
echo -----------------------------------
fi
if [ -e spigot1.jar]; then
rm spigot1.jar
fi
sleep 10s
但它会弹出一条错误消息说:
test.sh: 4: [: missing ]
test.sh: 12: [: missing ]
有没有办法来解决这个问题?在解决这个问题之前我不能继续!在此先感谢
- derpasaurs