Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
【Shell教学】生成git文件列表到Markdown和HTML
社区开发
685
views ·
0
replies ·
To
floor
Go
海天鹰
deepin
2019-08-05 01:02
Author
本帖最后由 sonichy 于 2019-8-4 17:25 编辑
#用于git主页自动部署,限制:文件名=链接名
#git ls-files 中文显示为\321,git config core.quotepath off 解决
#if的条件括号两边必须空格,条件最后用分号;结束
#多空格变一个空格,字符串外加引号解决
#换行符\n不能识别,echo -e 解决
1.生成Markdown
line=(`git ls-files`)
A="README.md"
B="index.htm"
s="# 标题\n"
for i in "${!line[@]}";
do
L=${line[$i]}
if [ $L != $A ] && [ $L != $B ]; then
s+="[${L%.*}](你的主页/$L) \n"
fi
done
echo -e "$s" > "README.md"
2.生成HTML
line=(`git ls-files`)
A="README.md"
B="index.htm"
s="\n\n标题\n\nbody { background:#eeeeee; }\nh1, h2 { text-align:center; }\np { text-indent:2em; font-size:1.5em; }\na { text-decoration:none; }\n\n\n\n
标题
\n"
for i in "${!line[@]}";
do
L=${line[$i]}
if [ $L != $A ] && [ $L != $B ]; then
s+="
${L%.*}
\n"
fi
done
s+="\n"
echo -e "$s" > "index.htm"
Reply
Like 0
Favorite
View the author
All Replies
No replies yet
Please
sign
in first
Featured Collection
Change
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
What is the purpose of UOS AI?
Cannot upgrade "Deepin 25.0.10"
Experience
Feature Request: Adding an option for a "Floating Dock" mode in DDE
[Feature Request] Drop-down grid panel for window snap layouts
Popular Events
More
#用于git主页自动部署,限制:文件名=链接名
#git ls-files 中文显示为\321,git config core.quotepath off 解决
#if的条件括号两边必须空格,条件最后用分号;结束
#多空格变一个空格,字符串外加引号解决
#换行符\n不能识别,echo -e 解决
1.生成Markdown
line=(`git ls-files`)
A="README.md"
B="index.htm"
s="# 标题\n"
for i in "${!line[@]}";
do
L=${line[$i]}
if [ $L != $A ] && [ $L != $B ]; then
s+="[${L%.*}](你的主页/$L) \n"
fi
done
echo -e "$s" > "README.md"
2.生成HTML
line=(`git ls-files`)
A="README.md"
B="index.htm"
s="\n\n标题\n\nbody { background:#eeeeee; }\nh1, h2 { text-align:center; }\np { text-indent:2em; font-size:1.5em; }\na { text-decoration:none; }\n\n\n\n
标题
\n"for i in "${!line[@]}";
do
L=${line[$i]}
if [ $L != $A ] && [ $L != $B ]; then
s+="
${L%.*}
\n"fi
done
s+="\n"
echo -e "$s" > "index.htm"