linux - 未预期的符号 `}' 附近有语法错误
迷茫
迷茫 2017-04-17 14:18:44
0
1
3250

1.照着这个文章学习bash编程http://blog.chinaunix.net/uid-20328094-id-95121.html
2.

#或运算符的使用
mailfolder=/var/spool/mail/james
[ -r "$mailfolder" ]''{ echo "Can not read $mailfolder" ; exit 1 ; }
echo "$mailfolder has mail from:"
grep "^From " $mailfolder

3.报错如下:

./b.sh: 行 36: 未预期的符号 `}' 附近有语法错误
./b.sh: 行 36: `[ -r "$mailfolder" ]''{ echo "Can not read $mailfolder" ; exit 1 ; }'
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
洪涛

Statement

[ -r "$mailfolder" ]' '{ echo "Can not read $mailfolder" ; exit 1; }
The middle of

should not be two single quotes ' ', but the OR operator ||.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template