









|
[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
[NMLUG] grep help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
id -Gn <user> | grep 'groupname'
Ed Heron wrote:
| I'm writing a bash script that needs to check if a particular person is
| in a specific group.
|
| I'm using:
|
| if grep "^${group}:.*[:,]${user}[,$]" /etc/group >/dev/null ; then echo
| "${user} is a member of ${group}" ; fi
|
| Unfortunately, if $user is last in the list it appears to be false. If
| I `grep "^${group}:.*[:,]${user}$" /etc/group` it succeeds.
|
| I don't use many regexp, am I missing something?
| _______________________________________________
| NMLUG mailing list
| NMLUG@nmlug.org
| http://www.nmlug.org/mailman/listinfo/nmlug
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCOMWZKaiGM/xGKzQRAgK7AKC5ZJHGo3+NplZUHrot+1g0i2b8NQCfUeqH
A7/rnSCWPdm6ab2ilzXcTAc=
=JwzV
-----END PGP SIGNATURE-----
|
|