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 ; }'
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 ||
.