Created
June 10, 2024 15:45
-
-
Save x3ric/6f4910563c3c9fb38120b77f42eb6f94 to your computer and use it in GitHub Desktop.
Local Man Pages TXT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$EUID" -ne 0 ]]; then | |
echo "Please run this script with sudo." | |
exit 1 | |
fi | |
mkdir -p "/home/$(logname)/man" | |
cd "/home/$(logname)/man" | |
filename="manpagelist.csv" | |
manpath=$(manpath) | |
IFS=':' read -r -a paths <<< "$manpath" | |
for path in "${paths[@]}"; do | |
find "$path" -type f -name '*.[0-9]*' | while read -r manpage; do | |
base=$(basename "$manpage") | |
name="${base%.*}" | |
echo "$name" | |
done | |
done | sort | uniq > "$filename" | |
while IFS=""; read -r manpagename; do | |
\man $manpagename > $manpagename.txt | |
done < $filename | |
echo "Done... Text files located in $(pwd)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment