From e7e71aa0023b961cf418d4b8c32c1d5a752a3b98 Mon Sep 17 00:00:00 2001 From: Anathema Date: Tue, 25 Oct 2011 19:55:48 +0200 Subject: [PATCH] fix #52: when trying to get user home directory in exec_safe_bind_hooks, the grep and sed commands doesn't output the right result when multiple lines occours. Now, we use awk to do so --- src/tomb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tomb b/src/tomb index 35693c3..b6b032c 100755 --- a/src/tomb +++ b/src/tomb @@ -724,7 +724,7 @@ exec_safe_bind_hooks() { fi local MOUNTPOINT="${1}" local ME=${SUDO_USER:-$(whoami)} - local HOME=$(grep $ME /etc/passwd | sed "s/^${ME}:.*:.*:.*:.*:\([\/a-z]*\):.*$/\1/" 2>/dev/null) + local HOME=$(awk -v a="$ME" -F ':' '{if ($1 == a) print $6}' /etc/passwd 2>/dev/null) if [ $? -ne 0 ]; then error "how pitiful! A tomb, and no HOME" return 1