- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: .profile loses variables set in script evoked ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 02:22 AM
12-08-2004 02:22 AM
Here's the .profile:
# @(#)B.11.11_LR
# Default (example of) super-user's .profile file
# Do not put "." in PATH; it is a potential security breach.
# Do not put "/usr/local/bin" in PATH; it is a potential security breach.
# Example assumes /home/root exists.
set +u
PATH=/usr/sbin:$PATH:/sbin:/home/root
# Be sure that VUE does not invoke tty commands
if [ ! "$VUE" ]; then
# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs
TERM=vt220
echo
echo "Value of TERM has been set to \"$TERM\". "
export TERM
EDITOR=vi
export EDITOR
set -o vi
fi # if !VUE
# Set up shell environment:
set - u # error if undefined variable.
trap "echo 'logout root'" 0 # what to do on exit.
umask 022 # set umask u=rwx,g=rx,o=rx
# Set up shell variables:
trap "echo 'logout root'" 0 # what to do on exit.
umask 022 # set umask u=rwx,g=rx,o=rx
# Set up shell variables:
MAIL=/var/mail/root
# don't export, so only login shell checks.
HISTFILE=${HOME}/.sh_history
PS1="$(hostname):\$PWD\#"
export HISTFILE PS1
echo "WARNING: YOU ARE {USER} SUPERUSER !!\n"
export ORACLE_HOME=/appl/oracle/product/9.2
PATH=$ORACLE_HOME/bin:$PATH:.
export PATH
alias -x pas='cd /appl/psoft/; ll'
export pas
/appl/psoft/psconfig.sh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 02:28 AM
12-08-2004 02:28 AM
Re: .profile loses variables set in script evoked from profile
I assume that /appl/psoft/psconfig.sh is the script that's setting the variables that are being lost. Given that, the problem would be that, as written, it's spawning a separate shell and the variables are getting set there rather than in this shell. Put a "dot space" in front of it: . /appl/psoft/psconfig.sh
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 02:31 AM
12-08-2004 02:31 AM
Re: .profile loses variables set in script evoked from profile
. /somedir/.profile
That first . must be all by itself. Sourcing also works inside a script and used fairly commonly in /etc/profile to set a common set of values:
. /etc/set_oracle_values
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 02:34 AM
12-08-2004 02:34 AM
Re: .profile loses variables set in script evoked from profile
thx for your reply.
We've tried that, but then we get
${HOME:-.}/.profile[63]: IS_PS_PLT: parameter not set
at login.
This IS_PS_PLT is the first variable being called the script /appl/psoft/psconfig.sh, so it doesn't seem to read any of the script's variables in that case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 02:49 AM
12-08-2004 02:49 AM
Re: .profile loses variables set in script evoked from profile
. /appl/psoft/psconfig.sh
and that works. But in this profile it doesn't, unless we add /usr/bin/ksh to the script.
And does anybody know why the alias doesn't work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 06:46 AM
12-08-2004 06:46 AM
Re: .profile loses variables set in script evoked from profile
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 07:33 AM
12-08-2004 07:33 AM
Re: .profile loses variables set in script evoked from profile
In the profile that you posted, i do not see the variable IS_PS_PLT defined and exported.
If you don't define and export the variable in .profile, you need to do so in the second script that you are calling from within the .profile
You need to export all variables for the child shells to use that variable.
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 10:01 AM
12-08-2004 10:01 AM
Re: .profile loses variables set in script evoked from profile
At about the middle of your profile it runs "set -u". That will cause any reference to an undefined variable to error with the "parameter not set" message you are getting.
You either need to define the variables before they are referenced or remove the "set -u". Defining the variables may be the best bet since the "set -u" behavior can save you a lot of headaches caused by typos in your scripts.
--
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 07:44 PM
12-08-2004 07:44 PM
Re: .profile loses variables set in script evoked from profile
I'm afraid all variables are defined and exported in the script /appl/psoft/psconfig.sh before they are referenced anywhere.
Our profile executes the script /appl/psoft/psconfig.sh, with /usr/bin/ksh at the end to invoke a new shell. Without that, the first shell cannot find the variables.
Script /appl/psoft/psconfig.sh is ootb Peoplesoft and does not contain #!/usr/bin/ksh at the beginning.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2004 04:48 AM
12-09-2004 04:48 AM
SolutionLooking at the psconfig.sh file on a PeopleSoft installation here, the IS_PS_PLT variable is referenced in an if statement right at the beginning of the script. That if statement is used to determine if the script should continue (IS_PS_PLT is not set to "Y") or if it has already been sourced (IS_PS_PLT is set to "Y"). If it makes it passed that, then IS_PS_PLT is defined and exported. Is yours the same?
If you run psconfig.sh using:
/usr/bin/ksh -u /appl/psoft/psconfig.sh
you should see the same error you are seeing from your profile (since your profile does a "set -u" prior to sourcing psconfig.sh).
--
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2004 07:28 PM
12-09-2004 07:28 PM
Re: .profile loses variables set in script evoked from profile
Indeed, the script starts with
if [ "$IS_PS_PLT" = "Y" ]
I just assumed that if this Y is not there, it would just continue with the "else", but it obviously didn't. I exported the variable (and $SHLIB_PATH) in the profile, and it works.
Thanks all for your replies!
Bart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2004 07:34 PM
12-09-2004 07:34 PM