git: 8a5c836b51ce - main - man: fix `man -K` search
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Aug 2023 20:48:00 UTC
The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8a5c836b51ce29fb22e0692c03fbc1e405c6522f commit 8a5c836b51ce29fb22e0692c03fbc1e405c6522f Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2023-08-01 18:00:48 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2023-08-02 20:46:57 +0000 man: fix `man -K` search Quote re arg to grep in case it has spaces, and quote [:blank:] tr arg to avoid the shell interpreting []. PR: 272729 Reviewed by: Mina Galić <freebsd@igalic.co> Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41282 --- usr.bin/man/man.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index 4fd6f886e87f..c95b47e2ee62 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -1000,11 +1000,11 @@ do_full_search() { gflags="${gflags} --label" set +f - for mpath in $(echo "${MANPATH}" | tr : [:blank:]); do - for section in $(echo "${MANSECT}" | tr : [:blank:]); do + for mpath in $(echo "${MANPATH}" | tr : '[:blank:]'); do + for section in $(echo "${MANSECT}" | tr : '[:blank:]'); do for manfile in ${mpath}/man${section}/*.${section}*; do mandoc "${manfile}" 2>/dev/null | - grep -E ${gflags} "${manfile}" -e ${re} + grep -E ${gflags} "${manfile}" -e "${re}" done done done