mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-22 20:45:13 +00:00
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
This commit is contained in:
parent
350eeb7483
commit
e7e71aa002
2
src/tomb
2
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
|
||||
|
Loading…
Reference in New Issue
Block a user