comparison sbin/check-ports @ 348:9b388927b12b

FIX: Use BREs with grep because is handles "+" characters in package names properly. Otherwise a package like "lucene++" given an error: egrep: repetition-operator operand invalid
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 07 Dec 2022 01:37:39 +0100
parents 59a334dc9b53
children 8298a93dd083
comparison
equal deleted inserted replaced
347:673505e96cea 348:9b388927b12b
159 # some of the previous effects. 159 # some of the previous effects.
160 # 160 #
161 # "grep" does a fast pre-selection, reading, parsing and comparing is done for 161 # "grep" does a fast pre-selection, reading, parsing and comparing is done for
162 # exact matching. 162 # exact matching.
163 # 163 #
164 _lines=$(egrep '^'"${_package}" "${_indexdir}/${_indexfile}") 164 # Use BREs because a `+' char needs to be handled as an ordinary
165 # character (e.g. for the "lucene++" package).
166 # Note that `^' at the start of an RE is not an ordinary
167 # character. See re_format(7).
168 #
169 _lines=$(/usr/bin/grep -G '^'"${_package}" "${_indexdir}/${_indexfile}")
165 while read _line ; do 170 while read _line ; do
166 _fqpn="${_line%%|*}" 171 _fqpn="${_line%%|*}"
167 _n=${_fqpn%-*} 172 _n=${_fqpn%-*}
168 if [ "${_package}" = "${_n}" ] ; then 173 if [ "${_package}" = "${_n}" ] ; then
169 printf '%s' "${_fqpn##*-}" 174 printf '%s' "${_fqpn##*-}"