dotfiles/.bin/OLD/dexec_man.1

24 lines
1.5 KiB
Groff
Raw Normal View History

#!/bin/sh
. $HOME/.bin/_config
MAN1=$(man -s 1 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "1-"$1}')
MAN2=$(man -s 2 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "2-"$1}')
MAN3=$(man -s 3 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "3-"$1}')
MAN4=$(man -s 4 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "4-"$1}')
MAN5=$(man -s 5 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "5-"$1}')
MAN6=$(man -s 6 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "6-"$1}')
MAN7=$(man -s 7 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "7-"$1}')
MAN8=$(man -s 8 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "8-"$1}')
MAN9=$(man -s 9 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "9-"$1}')
MAN=$(printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
"$MAN1" "$MAN2" "$MAN3" "$MAN4" "$MAN5" "$MAN6" "$MAN7" "$MAN8" "$MAN9" \
| $DMENU_CMD -p "Manpage")
if [ ! -z "$MAN" ]; then
M="$(printf '%s' "$MAN" | cut -d"-" -f2)"
S="$(printf '%s' "$MAN" | cut -d"-" -f1)"
bterm -e man -s $S $M
fi