Last active
July 31, 2017 09:34
-
-
Save jiangtao/1e2571d0c293cfb4416cc42c3cae366f to your computer and use it in GitHub Desktop.
Revisions
-
jiangtao revised this gist
Jul 31, 2017 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,20 +3,23 @@ from="src" to="dist" type="docx" # 检测brew if ! command -v brew >/dev/null 2>&1; then echo "brew没有安装,请安装" exit 0 fi # 检测pandoc if ! command -v pandoc >/dev/null 2>&1; then brew install pandoc fi # 检测 from if [ ! -d $from ]; then echo "src不存在" exit 0 fi # 检测 to if [ ! -d $to ]; then mkdir $to fi @@ -29,8 +32,6 @@ if [ $count == 0 ]; then exit 0 fi cd $from list=$(ls | grep ${type}) @@ -41,5 +42,4 @@ for doc in $list mv ${doc/${type}/html} "../${to}" done echo "src下所有的docx文件转换成html成功" -
jiangtao revised this gist
Jul 31, 2017 . 1 changed file with 40 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,45 @@ #!/bin/bash from="src" to="dist" type="docx" if ! command -v brew >/dev/null 2>&1; then echo "brew没有安装,请安装" exit 0 fi if ! command -v pandoc >/dev/null 2>&1; then brew install pandoc fi if [ ! -d $from ]; then echo "src不存在" exit 0 fi if [ ! -d $to ]; then mkdir $to fi # 检测src下是否含有docx count=$(ls $from | grep ${type} | wc -l) if [ $count == 0 ]; then echo "src为空, 请放置文档到src目录下" exit 0 fi cd $from list=$(ls | grep ${type}) for doc in $list do pandoc -s ${doc} -t html -o ${doc/${type}/html} mv ${doc/${type}/html} "../${to}" done echo -e "src下所有的docx文件转换成html成功" -
jiangtao renamed this gist
May 27, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
jiangtao created this gist
May 27, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ #!/bin/bash type="docx" list=$(ls | grep ${type}) targetType="html" for doc in $list do pandoc -s ${doc} -t ${targetType} -o ${doc/${type}/${targetType}} done