# by StruggleYang # this is update hexo page or post and backup source this=$0 message=$1 help="help" server="-s" # Always pull the latest git pull origin master && if [ -n "$message" ] then if [ "$message" = "$help" ] then echo" $this>>help : " echo" There is only one parameter: commit-message or -s [locahost server preview Blog] " echo" After the command, add updates to this blog and submit it to the backup repository!" elif [ "$message" = "$server" ] then echo" $this ====hexo >> clean >> generate >> server " echo"==========hexo clean ...===========" && hexo clean && echo"==========hexo generate ...=========" && hexo g && echo"==========hexo server ...=========" && hexo s else echo" $this ==== [hexo] >> clean >> generate >> deploy ==|~|== [git] >> add >> commit >> push " echo"==========hexo clean ...===========" && hexo clean && echo"==========hexo generate ...=========" && hexo g && echo"==========hexo deploy ...===========" && hexo d && echo"==========backup hexo source to git.osc ...=========" && git add -A . && echo"==========commit message: [ $message ]=========" && git commit -m "$message" && git push origin master fi else echo" $this>>help : " echo" There is only one parameter: commit-message or help or -s [locahost server preview Blog]" echo" After the command, add updates to this blog and submit it to the backup repository!" fi
echo" ==========Over==========="
假设已经将此脚本命名为up.sh
当我输入 sh up.sh时:
1 2 3 4 5
$ sh up.sh up.sh>>help : There is only one parameter: commit-message or help or -s [locahost server preview Blog] After the command, add updates to this blog and submit it to the backup repository! ==========Over===========