./chkf: line 30: syntax error near unexpected token `elif'
'/chkf: line 30: `elif [ -f "$object" ] ; then
if [ -d "$object" ] ; then
message="$message a directory"
elif [ -f "$object" ] ; then
message="$message a regular file."
else
message="$message not a known file type"
fi
./chkf: line 38: syntax error near unexpected token `else'
'/chkf: line 38: `else
if [ -w "$object" ] ; then
write="writeable"
else
write="not writeable"
fi
有什么不对呢?这似乎是正确的。我尝试了很多变化,无法弄清楚什么是错误的。有没有某种无形的角色?如果是这样,是否有命令将其剥离?
编辑:当我在顶部加入#!/bin/bash
,我得到以下错误:
interpreter "/bin/bash" not found
file link resolves to "/usr/bin/bash"
-bash: ./chkf: /bin/bash^M: bad interpreter: No such file or directory
你用的是什么外壳?请发布[最小测试用例](http://sscce.org/),而不是片段。 – outis 2010-11-15 07:04:58
@outis我正在使用bash – Strawberry 2010-11-15 07:05:27
什么版本? 'echo $ BASH_VERSION' – outis 2010-11-15 07:06:31