• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

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
0
tumma
Asked:
tumma
  • 2
1 Solution
 
tummaAuthor Commented:
Edited text of question.
0
 
gunny051499Commented:
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 ;)
0
 
n0ctrnlCommented:
also, if you want an environment variable set for all users (global) set it in /etc/profile
If i wanted to set the variable $BLAH to be 'nothing' itd look like this:

export BLAH=nothing

thatd do it as well
      
0
 
tummaAuthor Commented:
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
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now