- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script to get user primary group ID
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2005 08:52 PM
тАО04-03-2005 08:52 PM
and then use case structure to run different
programs depend on the primary GID, but could not figure out how to get primary GID to pass to the CASE structure.
Please help.
Thanks,
Tom
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2005 09:03 PM
тАО04-03-2005 09:03 PM
Re: script to get user primary group ID
field 4 of the /etc/passwd file gives the group id of the user.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2005 09:08 PM
тАО04-03-2005 09:08 PM
Re: script to get user primary group ID
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2005 09:08 PM
тАО04-03-2005 09:08 PM
Solutionif you want gid as number try this:
id | awk '{print $2}' | sed 's/gid=\([0-9]*\)(.*/\1/'
ex: of case
GID=`id | awk '{print $2}' | sed 's/gid=\([0-9]*\)(.*/\1/'`
case "$GID" in
'20')
echo "User group"
;;
'3')
echo "This is sys group"
;;
*)
esac
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2005 10:04 PM
тАО04-03-2005 10:04 PM
Re: script to get user primary group ID
# id -gn # Print GID as name
Examle:
# id -g
3
# id -gn
sys
Script: (We expect GID as number)
GID=`id -g`
case "$GID" in
'3') do somthing;;
'1025') do somthing;;
*) do default;;
esac
Roland
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 03:12 AM
тАО04-04-2005 03:12 AM
Re: script to get user primary group ID
it's all work out great.
points will be assigned.
case close.
Regards,
Tom