all repos — site @ b55eecbaefac6f2e320a41cd5458146643f777ce

source for my site, found at icyphox.sh

bin/plaintext.sh (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
#!/bin/sh 

# from the pure sh bible; see: 
# https://github.com/dylanaraps/pure-sh-bible#get-the-base-name-of-a-file-path
basename() {
    dir=${1%${1##*[!/]}}
    dir=${dir##*/}
    dir=${dir%"$2"}
    base="${dir:-/}"
}

for p in pages/blog/*.md; do
    basename "$p"
    [ "$base" != "_index.md" ] &&
        cp "$p" "build/blog/${base%.*}.txt"
done