Part 1
Is getent
supposed to be an executable?
In my zsh setup, I can see getent is actually defined as a function
$ which getent
getent () {
if [[ $2 = <-> ]]
then
grep ":$2:[^:]*$" /etc/$1
else
grep "^$2:" /etc/$1
fi
}
If I want to execute it from bash shell,
bash -c "getent passwd user"
I get a getent: command not found
error.
Part 2
In Mac OSX, getent
fails regardless if the user id is valid or not. It turns out the user id is not kept in the /etc/passwd
file. Why it is so? And what is the alternative?