Link to home
Start Free TrialLog in
Avatar of tumma
tumma

asked on

setting environment

I have certain environments which has to be set in certain user profiles,I have to do this by running a file which has these environments
Can somebody please let me know as how to create this particular file so that when i run this file it sets the environment of the user
Please let me know
One way i can say how can i create a batch file just like the dos batch file and howd do i run it on the unix environment
Thanks in advance
Arun
Avatar of tumma
tumma

ASKER

Edited text of question.
as i understand you, all you need is some environment variables set at login time, right?

to do this edit either the file ".login" or ".profile" (notice the dots at the beginning) in each users home directory.

if you need to create a "batch file" (called shell script in unix), just create a file with whatever editor you'd like (vi, vim, joe, ee, emacs, kwrite, nedit, xemacs, ...) and add the following into the first line:

#!/bin/sh

this causes the file to be executed by the standard shell of your system (in most cases bash). you could also set something like:

#!/bin/bash

or

#!/bin/tcsh

just don't forget to set the right permissions on the file (remember: in order to execute a file in unix it must have the executeable right set). do this by typing:

chmod 755 myfile.sh

(note the .sh at the end: this indicates to everyone that this SHOULD be a shell script) this will set the read, write and execute right to the owner (you) and the read and execute right to both group and others.

one other thing: often the current directory is not included in the default search path (given by the environment variable $PATH), so either copy the file to one of this paths (ie., /bin, /usr/bin, ...) or execute it with pathname by typing one of the following:

/full/path/to/myfile.sh
../myfile.sh (if your actualy in that directory)

so much for the one-point-question ;)
ASKER CERTIFIED SOLUTION
Avatar of n0ctrnl
n0ctrnl

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tumma

ASKER

U are right i did experiment before this answer came and got the result
Anyway THANK U VERY MUCH FOR HELPING ME
THANKS AGAIN
ARUN