github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/man/md2man-all.sh (about) 1 #!/bin/bash 2 set -e 3 4 # get into this script's directory 5 cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 6 7 [ "$1" = '-q' ] || { 8 set -x 9 pwd 10 } 11 12 for FILE in *.md; do 13 base="$(basename "$FILE")" 14 name="${base%.md}" 15 num="${name##*.}" 16 if [ -z "$num" -o "$name" = "$num" ]; then 17 # skip files that aren't of the format xxxx.N.md (like README.md) 18 continue 19 fi 20 mkdir -p "./man${num}" 21 go-md2man -in "$FILE" -out "./man${num}/${name}" 22 done