瀏覽代碼

HPCC-11258 Improve grep pattern to get user home directory

Xiaoming Wang 11 年之前
父節點
當前提交
8ee9f18f4a
共有 1 個文件被更改,包括 1 次插入1 次删除
  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 ""