Explorar o código

HPCC-11258 Improve grep pattern to get user home directory

Xiaoming Wang %!s(int64=11) %!d(string=hai) anos
pai
achega
8ee9f18f4a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      initfiles/bash/etc/init.d/install-init.in

+ 1 - 1
initfiles/bash/etc/init.d/install-init.in

@@ -178,7 +178,7 @@ binPath="$path/bin"
 add_user $user $group $homePath || exit 1
 
 # If user already exists get the home directory
-homePath=$(cat /etc/passwd | grep -e "^$user" | cut -d':' -f6)
+homePath=$(cat /etc/passwd | grep -e "^${user}:" | cut -d':' -f6)
 homeBase=$(dirname $homePath)
 echo ""