【发布时间】:2013-08-09 21:22:19
【问题描述】:
我正在为我的世界服务器插件更新程序制作此代码
我是一个新的 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
fi
# stop
sleep 3s
exit
我得到这个错误:
Syntax error: end of file unexpected (expecting "then")
所以我把“then”放在它想要的地方并再次运行它:
它现在给了我这个错误:
Syntax error: end of file unexpected
我在 Windows 7 notepad++ 上写的
我该如何解决这个问题?
【问题讨论】:
-
您发布的代码不会导致错误。
-
或者您是否在基于 Windows 的编辑器中编写了此脚本,然后将其复制到您的 linux 服务器而不运行
dos2unix myPluginScript。 ?祝你好运。 -
dos2unix 不工作
-
@user2649805 不起作用是什么意思?该实用程序是否存在于您的安装中,或者您仍然收到错误?
标签: linux shell unix minecraft