use*_*805 0 unix linux shell syntax-error minecraft
我想写一个.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
Run Code Online (Sandbox Code Playgroud)
但它弹出一条错误信息说:
test.sh: 4: [: missing ]
test.sh: 12: [: missing ]
Run Code Online (Sandbox Code Playgroud)
有没有办法来解决这个问题?在修复之前我无法继续下去!提前谢谢
- derpasaurs
你需要空间
if [ -e spigot1.jar ]; then
Run Code Online (Sandbox Code Playgroud)
代替
if [ -e spigot1.jar]; then
Run Code Online (Sandbox Code Playgroud)