From 2991ec1e59d386888f91142214a42d00bedb9336 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Fri, 25 Aug 2017 15:13:51 +0800 Subject: [PATCH] Fix 3749, handle '+' and '-' in id when merging /etc/passwd (#3771) * Fix 3749, handle '+' and '-' in id when merging /etc/passwd * Add some comments --- xCAT-server/share/xcat/scripts/xdcpmerge.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/scripts/xdcpmerge.sh b/xCAT-server/share/xcat/scripts/xdcpmerge.sh index 3941d79ad..b7724e9f1 100755 --- a/xCAT-server/share/xcat/scripts/xdcpmerge.sh +++ b/xCAT-server/share/xcat/scripts/xdcpmerge.sh @@ -76,7 +76,9 @@ for i in $*; do delim="|" for u in $removeusers do - userlist=$userlist$u$delim + # For special char +/-, need to escape + [[ "${u:0:1}x" =~ ^\+|\-x ]] && uu="\\$u" || uu="$u" + userlist=$userlist$uu$delim done # remove the last delimiter userlisttmp="${userlist%?}"