1833758 Members
2722 Online
110063 Solutions
New Discussion

Setting an environment

 
Joe_Flow_1
Advisor

Setting an environment

im trying to set up a user base environment changes for some software.

the instructions say to set it in the users .login file by using "setenv"

I read on hp that setenv is not avaliable on hp-ux11i V1 so I dont know what to do. I tried set and env but im not sure how to write it in the .login

here are the changes Im suppose to make

setenv PLATFORM `uname -s`_`uname -r`

there are a few others but its in the same format....

Thank you
7 REPLIES 7
Jonathan Fife
Honored Contributor

Re: Setting an environment

setenv is for csh. To use the same command in sh/ksh you need to use the export command -- eg.
setenv VAR1 "value"
becomes
VAR1=value;export VAR1

Alternatively, you could change your default shell to csh by modifying the default shell in /etc/passwd, but since csh is NOT a modern shell and lacks a lot of features I think you'd be better of converting the commands to a POSIX compatible format (sh, ksh, etc.)

If you have more questions about syntax I'm sure a lot of people here would love to help out.
Decay is inherent in all compounded things. Strive on with diligence
Joe_Flow_1
Advisor

Re: Setting an environment

Should it matter what shell you are in if it goes into .login file since it is on boot.
RAC_1
Honored Contributor

Re: Setting an environment

Set it in .login if login shell for user is csh, else in .cshrc or .profile in case of posix shell. (sh and ksh)
There is no substitute to HARDWORK
Joe_Flow_1
Advisor

Re: Setting an environment

so if the shell is csh....


setenv for V1 of hpux does not excist, what do I use...

The exprt he said earlier was for Posix shell...?
Ralph Grothe
Honored Contributor

Re: Setting an environment

The setenv command is a so called shell built in of csh.
So it's got to be available when you run this shell.
Madness, thy name is system administration
Joe_Flow_1
Advisor

Re: Setting an environment

The setenv and unsetenv functions exist on Tru64 UNIX, and will be available with the HP-UX 11i v2 May 2005 release. These functions are also available on a temporary basis in the Tru64 UNIX Migration Environment for HP-UX.\

http://devrsrc1.external.hp.com/STKT/impacts/i331.html

we have v1


Im not sure if what you told me is still true. This is why I thought setenv didnt work.
spex
Honored Contributor

Re: Setting an environment

Joe,

I think you're confusing shells and OS releases. First review /etc/passwd. Check which shells your users are using. Then change the appropriate file in the appropriate way based on the shell each user has assigned.

Under csh
==========
* Login script: /home/user/.login
* Login script: /home/user/.cshrc
* Syntax for setting/exporting an environmental variable: "sentenv VARIABLE value"

Under sh-posix, ksh, etc.
==========================
* Login script: /home/user/.profile
* Syntax for setting/exporting an environmental variable: "VARIABLE=value; export VARIABLE"

For other differences between various shells, see:
www.hep.phy.cam.ac.uk/lhcb/LHCbSoftTraining/documents/ShellChoice.pdf

As was already mentioned, use of csh is deprecated. You should switch your users over to sh-posix or ksh, if possible.

PCS