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
My version not relying on grep.
First parameter (mandatory): group Second parameter (optional, defaults to current user)
isInGroup(){ group="$1" user="${2:-$(whoami)}" ret=false for x in $(groups "$user" |sed "s/.*://g") do [[ "$x" == "$group" ]] && { ret=true ; break ; } done eval "$ret" }