Operating System - HP-UX
1833589 Members
3713 Online
110061 Solutions
New Discussion

Re: Setting environment in .profile is not working

 
Henry Hopkinson
Occasional Contributor

Setting environment in .profile is not working

Case: a user has to start a program called formula-rg, but get the following error message since corret environment variables has not been set:

Unable to initialize FOCUS, vtm tables missing ?

If I do the following:

cd /usr/fmora/bin
. ./fm-env.profile

The program formula-rg starts ok.

I want to implement this in the users .profile, but I've never got this working.

These are the last lines of the .profile:

# Set up shell variables:
ORACLE_HOME=/u01/app/oracle/product/8.0.6;export ORACLE_HOME
ORACLE_TERM=vt220;export ORACLE_TERM
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data;export ORA_NLS33
ORACLE_DOC=$ORACLE_HOME/odoc;export ORACLE_DOC
ORACLE_SID=fm;export ORACLE_SID
PATH=$ORACLE_HOME/bin:/usr/local/bin/:$PATH:/usr/fmora/bin;export PATH

# don't export, so only login shell checks.
echo "Value of TERM has been set to \"$TERM\". "
export TERM
stty erase "^H" kill "^U" intr "^C" eof "^D"
exec ksh -o emacs
. ./usr/fmora/bin/fm-env.profile

But the user still get the error message, so what I added to .profile did not have any effect. Why not?

These are the first few lines of fm-env.profile:
PROMULA2:/usr/formula>more /usr/fmora/bin/fm-env.profile
:
#-------------------------------------------------------------------------------
# @(#)fm-env.profile 2000, 96/05/03, MD Applikasjon : Define environment var.
#
# Environment variables used by the Merkantildata Applikasjon systems.
# Bourne Shell interface.
#
# If called from batch then env. var. $FMBTC must be set to "B" before call.
# If you want to set env.var. for a DB-type Oracle, env. var. $SETDB
# must be "O"/"T"/"S".
#

and the users env looks like this:

_=/usr/bin/env
MANPATH=/usr/share/man/%L:/usr/share/man:/usr/contrib/man/%L:/usr/contrib/man:/n
PATH=/u01/app/oracle/product/8.0.6/bin:/usr/local/bin/:/usr/sbin:/usr/bin:/usr/n
COLUMNS=80
EDITOR=vi
LOGNAME=formula
MAIL=/var/mail/formula
ERASE=^H
ORACLE_SID=fm
PS1=PROMULA2:${PWD}>
ORACLE_DOC=/u01/app/oracle/product/8.0.6/odoc
SHELL=/usr/bin/sh
ORACLE_TERM=vt220
ORA_NLS33=/u01/app/oracle/product/8.0.6/ocommon/nls/admin/data
HOME=/usr/formula
TERM=vt220
ORACLE_HOME=/u01/app/oracle/product/8.0.6
PWD=/usr/formula
TZ=MET-1METDST
LINES=24

Why is this not working?
Sysadm_Henry
4 REPLIES 4
Philip Chan_1
Respected Contributor

Re: Setting environment in .profile is not working


Have you exported the requiring variables?

~Philip
Alex Glennie
Honored Contributor

Re: Setting environment in .profile is not working

Are you using CDE and a dtterm or similar ? if yes try dtterm -ls (see man dtterm) or vi $HOME/.Xdefaults and add :

*loginShell : True

exit CDE or reload resources should resolve the problem.

fyi dtterm under CDE does not by default read your .profile unless the above are set, the same is true of xterms and hpterms
Justo Exposito
Esteemed Contributor

Re: Setting environment in .profile is not working

Hi henry,

You must set the same variables in the .profile
that you have in the ./fm-env.profile.

Probably if you cut and paste the fm-env.profile file into .profile at the end of the file all works fine.

Please attach both files in order to clear the issue.

Hope this help.
Justo.
Help is a Beatiful word

Re: Setting environment in .profile is not working

Two points...

1. This is from your users .profile:

exec ksh -o emacs
. ./usr/fmora/bin/fm-env.profile

The 'exec ksh -o emacs' is actually launching an entirely new shell, so the next line doesn't get executed until the user types 'exit' or 'ctrl-d'

If the users shell needs to be ksh rather than sh, chnage it in /etc/passwd rather than executing a new shell in the .profile

2. Unless there is a 'usr' directory in your users home directory the attempt to source the fm-env is wrong, it should be:

. /usr/fmora/bin/fm-env.profile




I am an HPE Employee
Accept or Kudo