From 7924c1339cc76bb7f8ab2c4a17cea751be7ef509 Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Tue, 16 Apr 2019 23:28:30 +0300 Subject: [PATCH] __acl: avoid duplication and safer sed for last occurence replacement --- cdist/conf/type/__acl/gencode-remote | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__acl/gencode-remote b/cdist/conf/type/__acl/gencode-remote index fd763b8f..56c1cbc1 100755 --- a/cdist/conf/type/__acl/gencode-remote +++ b/cdist/conf/type/__acl/gencode-remote @@ -41,10 +41,12 @@ do then if [ "$is_dir" = '1' ] then - acl="$( echo "$acl" | sed 's/X$/x/' )" + rep=x else - acl="$( echo "$acl" | sed 's/X$/-/' )" + rep=- fi + + acl="$( echo "$acl" | sed -r "s/(.*)X/\1$rep/" )" fi if echo "$parameter" | grep -Eq '(mask|other)'