I have a server running where I use php to run a bash script to verify certain information of a user. For example, I have a webhosting server set up, and in order to be able to
Sounds like an another answer:
username='myuser'
if grep -q -E "^customers:.*[:,]$username(,.*|\b)" /etc/group; then
echo 'true'
else
echo 'false'
fi
As reported by sputnick
the output of the groups
command may depend on your OS.
I am not sure how this code is going to perform, but most probably it will do better.