Merge aa-decode: use grep -E instead of egrep

egrep and fgrep are deprecated and will print a warning in the next grep release (3.8)

https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/792
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2021-08-24 08:29:04 +00:00
commit 7711baae4a

View file

@ -37,7 +37,7 @@ EOM
}
decode() {
if echo "$1" | egrep -q "^[0-9A-Fa-f]+$" ; then
if echo "$1" | grep -E -q "^[0-9A-Fa-f]+$" ; then
python3 -c "import binascii; print(bytes.decode(binascii.unhexlify('$1'), errors='strict'));"
else
echo ""
@ -53,7 +53,7 @@ fi
# if have an argument, then use it, otherwise process stdin
if [ -n "$1" ]; then
e="$1"
if ! echo "$e" | egrep -q "^[0-9A-Fa-f]+$" ; then
if ! echo "$e" | grep -E -q "^[0-9A-Fa-f]+$" ; then
echo "String should only contain hex characters (0-9, a-f, A-F)"
exit 1
fi