Visit Our UNIX and Linux User Community


setting global variable for all users


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers setting global variable for all users
# 1  
Old 08-13-2002
setting global variable for all users

hi,

i am a newbie unix administrator. i want to set a variable, let's say :

alias cls 'clear'

But i am not going to add this line in the .login file for every home directory of my 500+ users.

pls tell me where should i put this line in, so that all users can use this variable after login.

thank you and urgentSmilie
# 2  
Old 08-13-2002
I see you haven't heard back - and there may well (in fact probably is) a 'proper' way to do this.

however if this is urgent....it may be possible to use a simple find -exec to locate all .login or .profile files in the filesystem and append the data.

Not ideal I guess, but it would work if you're root......
# 3  
Old 08-13-2002
Just an idea ;-)

Isnīt it posible to create a standard .profile that is stored in a central folder reachable for all users that is included in the .profile for all users?

So at anytime you make changes for all users you only have to change that file.

Iīve seen that on an AIX Box but Iīve no more access to that box so I couldnīt figure out how they exactly implemented this feature.
Probably they just start the standart .profile and included the userīs .profile to make sure the users the users arenīt able to bypass the standart .profile.

Has anybody an idea how to implement this correctly?
# 4  
Old 08-14-2002
Theres a file called /etc/default/login

This will set global variables for all users in addition to their own .profile

This should solve your problem (hopefully).
# 5  
Old 08-15-2002
if you use bash, you can add variables to /etc/profile
and they will be available to all logined users.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #44
Difficulty: Easy
Data moves through the Internet in a data structure called a 'packet'.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Global Variable

Hi, I have created a variable say today at the begin having 123 as its value and inside a for loop it gets resolved to some value say 150 in its first iteration. How can I use this value 150 ( 1st iteration's ) outside the scope of for loop ?. In the same way I wanted to use all iteration's... (1 Reply)
Discussion started by: penqueen
1 Replies

2. UNIX for Advanced & Expert Users

Setting a permanent global variable in unix accessible from any script

Is there anyway in which i can set a permanent global variable in unix, which when initialised with a value and modified during any shell script, would retain its value even if i logout and login I dont know whether i am being able to express my need clearly but basically what i want is a... (3 Replies)
Discussion started by: arindamlive
3 Replies

3. Shell Programming and Scripting

Setting environmental variable for all the users in the box

Hi, I have Sun solaris x64 box in which i need to set a Environment variable for all the users in the box. This Environment varible is used by the application on the box. Could any one please help me in setting the Environment variable. Thanks, Firestar (6 Replies)
Discussion started by: firestar
6 Replies

4. Shell Programming and Scripting

Help with Global Variable

Hi Guyz, I have a requirement like, i have to run a script every hour to count the number of errors encountered. At the end of the day, i need to send them the total number of errors, that have ocurred the entire day. For eg. if 10 errors occurred for starting 1 hr, 5 for next 1 hr, so on.... (1 Reply)
Discussion started by: DTechBuddy
1 Replies

5. UNIX for Advanced & Expert Users

Setting global variables with BASH/Linux

I am using functions in a script and for some strange reason the EXPORT command doesnt seem to be making my variables global. Anyone got any ideas? I am using one function to pass some output top another using the pipe command, eg Function 1 | Function 2 Function 2 reads the value... (3 Replies)
Discussion started by: gregf
3 Replies

6. Shell Programming and Scripting

Global variable

I have written a shell scritp in which i am using a variable which is declared before a while loop and i am updaitng the variable in while loop and want to use its updated value outside the loop. I am not able to do so, b'coz the scope of the variable is limited to the while loop only and when i am... (5 Replies)
Discussion started by: deepanshu
5 Replies

7. UNIX for Dummies Questions & Answers

setting a global variable in script

Hi All, I know to set global variable i can use export .. But take the situation like below .. I want to set a variable in one script and access that in second script i have done like this .. It is not working one.sh #!/usr/bin/ksh echo $RISSHI export RISSHI=1 two.sh... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

8. UNIX for Advanced & Expert Users

Managing Users in a Global Environment

Hello, I am interested in your strategy for handling engineers Unix accounts when the engineers must log in to resources in a variety of locals in a global environment. The engineers home directory and normal environment is local to where the engineer is sitting. When they log in to a remote... (0 Replies)
Discussion started by: Randal
0 Replies

9. UNIX for Dummies Questions & Answers

Is there such thing as Global Env Variable for all users?

Hello im using SunOS and its great , I know I can setenv global environment variable per user but my question is can I setenv global environment variable in more higher level ( maybe some kind of root user or something) so that every users will see the same value of this global env (3 Replies)
Discussion started by: umen
3 Replies

10. UNIX for Dummies Questions & Answers

Global PATH setting

I am using Solaris 8 and I want to change the PATH setting for all users. I have edited /etc/profile, but when I log in and check the PATH variable, it hasn't changed. Am I missing something? (5 Replies)
Discussion started by: jxh
5 Replies

Featured Tech Videos