line 3 我这样捕获错误正不正确啊?
我输出的 res 是空的
#!/bin/bash
echo `hexo clean`
res=`hexo generate|grep ERROR`
echo "======== ${res} ========"
if [ ! -n "$res"]
then
echo `hexo deploy git`
echo "1"
else
echo $res > log
echo "0"
fi
顺便说下我想实现的功能
- 我在本地写好文章提交到github
- vps 每隔一段时间获取github的文章
- 将文章移到_post文件夹
- 然后 hexo 生成和发布
2-4是交给一个计划任务处理的