Jp *_*gan 9 html bash scripting
我没有bash经验,只想知道如何入门.
我必须编写一个正确格式化XHTML文档的bash脚本.例如转此:
<p>Test</p><ol><li>Test
</li><li>
Test</li></ol>
Run Code Online (Sandbox Code Playgroud)
进入这个:
<p>Test</p>
<ol>
<li>Test</li>
<li>Test</li>
</ol>
Run Code Online (Sandbox Code Playgroud)
现在我相信我必须做以下事情:
cat > format1 #create file
#!bin/bash
if tail of a line ends with "</A-a>": (like </li> or </ol> or </p> or </ul>)
add \n
fi
if head of a line = <ol> or <ul>
add \n
fi
Run Code Online (Sandbox Code Playgroud)
请帮我理解.这是我能想到的全部,我真的想知道如何解决它.