我正在为Minecraft服务器插件更新程序制作此代码我是一个新的shell脚本程序,所以我不知道很多...
当我运行此代码时,我收到一个错误:
#!/bin/sh
export PATH=$PATH:.
#Options
PLUGINDOWNLOADLINK=http://api.bukget.org/3/plugins/bukkit/$PLUGINNAME/latest/download
# Plugin folder
if [ -f $PWD\plugins ]; then
PLUG=$PWD\plugins
else
PLUG=$PWD\plug-ins
fi
cd $PLUG
if [ ! -f .\update ]; then
mkdir update
echo Making Directory "update"..
fi
# Plugins Found
for i in $( ls );
do
PLUGINNAME=$i
done
cd .\update
wget $PLUGINDOWNLOADLINK
# No Plugins Found
if [ ! -f $PLUG ]; then
echo
echo
echo No plugin found.
echo
echo
echo
echo Plugins can be downloaded here:
echo http://dev.bukkit.org/bukkit-plugins …Run Code Online (Sandbox Code Playgroud) 我想写一个.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 …Run Code Online (Sandbox Code Playgroud)