2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-28 12:58:07 +00:00

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
Signed-off-by: Michal Vasilek <michal.vasilek@nic.cz>
This commit is contained in:
Michal Vasilek 2021-08-24 09:44:07 +02:00
parent 1a190f2e30
commit e8f3a1b878
No known key found for this signature in database
GPG Key ID: 3F2178C85501EDA3

View File

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