Skip to content

Instantly share code, notes, and snippets.

View GKFX's full-sized avatar

George Bateman GKFX

View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@GKFX
GKFX / apropos.sh
Last active August 23, 2017 12:01
Interactive apropos bash function
# I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
# In some countries this may not be legally possible; if so:
# I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.
apropos() {
/usr/bin/apropos "${@}" |\
sed -n 's/\(\S*\) (\([^)]\))\s*- \(.*\)/\1 (\2)\c@\3\x00/p' |\
tr -d '\n' |\
xargs -0 whiptail --ok-button "Open" --output-fd 3 --title "apropos ${*}" --menu "Choose a man page." 25 100 16 -- 3>&1 1>&2 2>/dev/null |\
sed -n 's/^\(\S*\) (\([^)]\))$/\2 \1/p' |\