LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-15-2010, 01:37 AM   #1
Jerry Mcguire
Member
 
Registered: Jul 2009
Location: Hong Kong SAR
Distribution: RedHat, Fedora
Posts: 157

Rep: Reputation: 19
setup environment variables for groups


I can setup variables in ~/.bashrc for my own shells.
I can also setup variables globally in /etc/bashrc .

but then how do I setup variables for a group in Linux? So that users who belong to this group will see the variables, but not others?

Thanks
 
Old 06-15-2010, 02:40 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
In the global configuration file a simple check using the id command should do the trick. For example:
Code:
if [[ $(id -g) -eq 100 ]]
then
  export SOMETHING=some_value
fi
 
Old 06-16-2010, 10:01 PM   #3
Jerry Mcguire
Member
 
Registered: Jul 2009
Location: Hong Kong SAR
Distribution: RedHat, Fedora
Posts: 157

Original Poster
Rep: Reputation: 19
I was think the same. Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash: How to setup "global" environment variables? ArthurHuang Programming 2 02-07-2008 12:24 PM
Environment variables xeon123 Linux - General 6 05-18-2007 07:57 PM
Environment Variables - where do they go!?! iansoundz Linux - General 7 11-17-2005 02:27 AM
when to use environment variables? mark_2811 Programming 2 02-23-2004 06:09 PM
How to setup environment variables?? devraj Linux - Newbie 2 12-17-2001 04:30 AM


All times are GMT -5. The time now is 05:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration