scripts/man-search.sh

14 lines
360 B
Bash

# Arguments
PAGE=$1
SEARCH=$2
# Throw an error if no arguments are provided
if [ "$*" == "" ]; then
echo "You must provide arguments. ./man-search.sh <man page> <search query>"
exit 1
fi
# Take these arguments and search the manpage for the search query
man $PAGE | grep $SEARCH --color=auto || echo "Your search query wasn't found in this manpage"