star-ty

Generate content for online publication
git clone git://git.meso-star.fr/star-ty.git
Log | Files | Refs | README | LICENSE

00-find-man-pages.sh (723B)


      1 #!/bin/sh
      2 
      3 # Copyright (C) 2017-2025 |Méso|Star> (contact@meso-star.com)
      4 #
      5 # Copying and distribution of this file, with or without modification,
      6 # are permitted in any medium without royalty provided the copyright
      7 # notice and this notice are preserved. This file is offered as-is,
      8 # without any warranty.
      9 
     10 . "hooks/man-pages.sh"
     11 
     12 copy_man() # manual page
     13 {
     14   # shellcheck disable=SC2154
     15   echo "${MANPATH}" | sed 's/:/\n/g' | sed '/^$/d' | \
     16   while read -r i; do
     17     f="$(find "${i}" -type f -name "$1")";
     18     if [ -n "${f}" ]; then
     19       cp "${f}" ./
     20       >&2 printf "Found the manual page %s in %s\n" "$1" "${i}"
     21       break
     22     fi
     23   done
     24 }
     25 
     26 printf "%s\n" "${man_pages}" | while read -r i; do
     27   copy_man "${i}"
     28 done