cygwin下mmslite802.sh文件为什么提示异常结尾?
# mmslite802.sh #
# Examples:
# ./mmslite802.sh LINUX
# ./mmslite802.sh LINUX clean
##########################################################################
# ------------------------------------
# NOTE: The platform.mak included in every makefile specifies pthreads
# support if available. There is small performance penalty when
# multithreading support is enabled.
# The platform.mak shows how to disable multithreading support.
# ------------------------------------
# check if correct parameters were passed
if [ -z "$1" ]
then
echo "No command-line arguments. Must specify platform (LINUX, QNX, etc.)"
exit 0
fi
if [ "$1" = "clean" ]
then
echo "Must specify platform in first argument (LINUX, QNX, etc.)"
exit 0
fi
if [ "$1" = "LINUX" -o "$1" = "LYNX" -o "$1" = "QNX" -o "$1" = "AIX" ]
then
if [ -z "$2" ]
then
echo "==============================="
echo "= Making platform: $1"
echo "==============================="
mkdir obj_l
mkdir obj_n
mkdir obj_ld
mkdir obj_nd
mkdir obj_mvlu_l
mkdir obj_mvlu_n
mkdir obj_mvlu_ld
mkdir obj_mvlu_nd
if [ "$1" != "QNX" ]
then
mkdir obj_ositp4e_l
mkdir obj_ositp4e_n
mkdir obj_ositp4e_ld
mkdir obj_ositp4e_nd
mkdir obj_ositpxs_l
mkdir obj_ositpxs_n
mkdir obj_ositpxs_ld
mkdir obj_ositpxs_nd
fi
else
if [ "$2" = "clean" ]
then
rm -f cc.lst
rm -f foundry.tmp
echo "==============================="
echo "= Cleaning platform: $1"
echo "==============================="
else
echo "ERROR: invalid second argument: $2"
exit 0
fi
fi
else
echo "ERROR: unsupported platform: $1"
exit 0
fi
export PLATFORM=$1
# make directories
if [ ! -d ../../lib ]
then
mkdir ../../lib
fi
if [ ! -d ../../bin ]
then
mkdir ../../bin
fi
# set path to GNU make
if [ "$1" = "AIX" ]
then
alias make='/usr/local/bin/make'
fi
echo STARTING MAKE OF meml_l.a LIBRARY for $1 >> cc.lst 2>&1
make -f meml.mak $2 DFLAG=_l DEFS=-DDEBUG_SISCO # logging / no debug
echo STARTING MAKE OF meml_n.a LIBRARY for $1 >> cc.lst 2>&1
make -f meml.mak $2 DFLAG=_n # no logging / no debug
echo STARTING MAKE OF meml_ld.a LIBRARY for $1 >> cc.lst 2>&1
make -f meml.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
echo STARTING MAKE OF meml_nd.a LIBRARY for $1 >> cc.lst 2>&1
make -f meml.mak $2 OPT=-g DFLAG=_nd # no logging / debug
echo STARTING MAKE OF mem_l.a LIBRARY for $1 >> cc.lst 2>&1
make -f mem.mak $2 DFLAG=_l DEFS=-DDEBUG_SISCO # logging / no debug
echo STARTING MAKE OF mem_n.a LIBRARY for $1 >> cc.lst 2>&1
make -f mem.mak $2 DFLAG=_n # no logging / no debug
echo STARTING MAKE OF mem_ld.a LIBRARY for $1 >> cc.lst 2>&1
make -f mem.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
echo STARTING MAKE OF mem_nd.a LIBRARY for $1 >> cc.lst 2>&1
make -f mem.mak $2 OPT=-g DFLAG=_nd # no logging / debug
# CANNOT MAKE THESE ON QNX BECAUSE 'TP4' TRANPORT NOT PORTED
if [ "$1" != "QNX" ]
then
echo STARTING MAKE OF ositp4e_l.a LIBRARY for $1 >> cc.lst 2>&1
make -f ositp4e.mak $2 DFLAG=_l DEFS=-DDEBUG_SISCO # logging / no debug
echo STARTING MAKE OF ositp4e_n.a LIBRARY for $1 >> cc.lst 2>&1
make -f ositp4e.mak $2 DFLAG=_n # no logging / no debug
echo STARTING MAKE OF ositp4e_ld.a LIBRARY for $1 >> cc.lst 2>&1
make -f ositp4e.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
echo STARTING MAKE OF ositp4e_nd.a LIBRARY for $1 >> cc.lst 2>&1
make -f ositp4e.mak $2 OPT=-g DFLAG=_nd # no logging / debug
fi
echo STARTING MAKE OF ssec0_l.a LIBRARY for $1 >> cc.lst 2>&1
make -f ssec0.mak $2 DFLAG=_l DEFS=-DDEBUG_SISCO # logging / no debug
echo STARTING MAKE OF ssec0_n.a LIBRARY for $1 >> cc.lst 2>&1
make -f ssec0.mak $2 DFLAG=_n # no logging / no debug
echo STARTING MAKE OF ssec0_ld.a LIBRARY for $1 >> cc.lst 2>&1
make -f ssec0.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
echo STARTING MAKE OF ssec0_nd.a LIBRARY for $1 >> cc.lst 2>&1
make -f ssec0.mak $2 OPT=-g DFLAG=_nd # no logging / debug
# CANNOT MAKE THESE ON QNX BECAUSE 'TP4' TRANPORT NOT PORTED
if [ "$1" != "QNX" ]
then
#
# The following executables link to the "ositpxs" library.
#
echo STARTING MAKE OF cositpxs0_ld EXECUTABLE for $1 >> cc.lst 2>&1
make -f cositpxs0.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
echo STARTING MAKE OF sositpxs0_ld EXECUTABLE for $1 >> cc.lst 2>&1
make -f sositpxs0.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
echo STARTING MAKE OF uositpxs0_ld EXECUTABLE for $1 >> cc.lst 2>&1
make -f uositpxs0.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
echo STARTING MAKE OF scl_tpxs0_ld EXECUTABLE for $1 >> cc.lst 2>&1
make -f scl_tpxs0.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
#
# The following executable tests the IEC-61850 GOOSE Framework.
#
echo STARTING MAKE OF iecgoose_ld EXECUTABLE for $1 >> cc.lst 2>&1
make -f iecgoose.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
#
# The following executable tests the IEC 61850 GSE Management.
#
echo STARTING MAKE OF gse_mgmt_ld EXECUTABLE for $1 >> cc.lst 2>&1
make -f gse_mgmt_test.mak $2 OPT=-g DFLAG=_ld DEFS=-DDEBUG_SISCO # logging / debug
fi
这个脚本是一个商业软件中的,应该不会有问题啊,但为什么我在cygwin下执行时提示
./mmslite802.sh: line 379: syntax error: unexpected end of file
因为脚本太长了,我删掉了其中一些命令行和注释,但绝没有删掉一个if、fi、then或else之类的。
请高手帮我看看,会不会是cygwin的问题呢?cygwin我是完全安装的啊。
[解决办法]
1、在 windows 下用 ultraedit 处理一下吧,你用二进制方式看看是不是多个 '\r',
然后用它从 dos-> unix 转换吧,去掉那个多余的 '\r'
2、用 ftp 从 windows 上 get 过来吧,它也会对 txt 文件进行转换...