Linux下shell编程实现创建文章并打开

bash代码如下

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
echo "请输入文章名"
read title
echo "$title is your title"
cd /your/bolg/rootdir
hexo new $title
echo "创建成功"
cd /your/bolg/rootdir/source/_posts/
titles=$(find . -iname "*$title.md")
echo $titles
gnome-open $titles && exit