first commit
This commit is contained in:
commit
81099ce7a4
5 changed files with 95 additions and 0 deletions
17
read
Executable file
17
read
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
if ! [ -e one-section-per-line.txt ] || ! [ -e bookmark.txt ]; then
|
||||
echo "Please run $(dirname "$0")/init first to initialise the book"
|
||||
exit 1; fi
|
||||
head -"$(cat bookmark.txt)" one-section-per-line.txt | tail -1 |
|
||||
sed 's,<p>,\n\n,g;s,</p>,,g;s,</*em>,*,g;s,<h1>,\n# ,g;s,<h2>,\n## ,g;s,<h3>,\n### ,g;s,<h4>,\n#### ,g;s,</h[1-4]>,,g'
|
||||
|
||||
echo
|
||||
if [ "$(cat bookmark.txt)" -lt "$(wc -l < one-section-per-line.txt)" ]; then
|
||||
echo "Run $(dirname "$0")/next to read on."
|
||||
fi
|
||||
if [ $(cat bookmark.txt) -gt 1 ]; then
|
||||
echo "Run $(dirname "$0")/prev to go back."
|
||||
echo "Run $(dirname "$0")/init to restart."
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue