search

Home  >  Q&A  >  body text

linux - 未预期的符号 `}' 附近有语法错误

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 ; }'
迷茫迷茫2810 days ago3255

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 14:20:44

    Statement

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

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

    reply
    0
  • Cancelreply