- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: creating menu prompts to source different .env...
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
01-29-2002 09:11 AM
01-29-2002 09:11 AM
Do you have an example of a .profile that has a section which prompts the user on login as to which file to source?
Environment #1
. /k01/oracle/proddb/8.1.7/PROD.env
Environment #2
. /k02/oracle/prodappl/APPSORA.env
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 09:20 AM
01-29-2002 09:20 AM
SolutionPersonally, I would not add interactive prompts to a user's $HOME/.profile unless you condition the processing to *skip* the interactive dialog if the environment isn't a terminal-based (interactive) one in the first place!
That is:
if [ -t -eq 0 ]
then
interact_with_terminal
fi
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 09:22 AM
01-29-2002 09:22 AM
Re: creating menu prompts to source different .env files in .profile
echo "Which envionment?"
echo "1 for PROD"
echo "2 for APPSORA"
read userenv
if [ "$userenv" -eq 1 ]
then
. /k01/oracle/proddb/8.1.7/PROD.env
else
if [ "$userenv" -eq 2 ]
then
. /k02/oracle/prodappl/APPSORA.env
else
echo "stupid user - log them off"
fi
fi
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 10:40 AM
01-29-2002 10:40 AM
Re: creating menu prompts to source different .env files in .profile
Another way:
while true
do
echo "1) PROD"
echo "2) APPSORA"
echo "Enter Choice: \c"
read OPT
#
case "$OPT" in
1) . /k01/oracle/proddb/8.1.7/PROD.env
break;;
2) . /k02/oracle/prodappl/APPSORA.env
break;;
esac
done
I like James' note about interactive sessions.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 11:22 AM
01-29-2002 11:22 AM
Re: creating menu prompts to source different .env files in .profile
Login: joeuser env1
Passwd: *******
...
Then in your .profile you can check for variable "env1".
Do a man on "login" to find out more about passing environmental variables at the login prompt.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 11:24 AM
01-29-2002 11:24 AM
Re: creating menu prompts to source different .env files in .profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 11:32 AM
01-29-2002 11:32 AM
Re: creating menu prompts to source different .env files in .profile
What JRF means is that other processes might use that profile, and if you don't program (write code in your script) for it, then those processes will likely fail. Those "other" processes are not interactive terminal users, like cron jobs, at jobs, and such...
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 11:46 AM
01-29-2002 11:46 AM
Re: creating menu prompts to source different .env files in .profile
Yes, Harry understood my point exactly (thanks, Harry). I'd leave the profile configuration as general as possible. The idea of having separate files which a user (or script) sources to obtain additional environmental variables is quite valid. If these additonal files contain *only* variable declarations (and perhaps aliases) then they can be exploited at command-line or in scripts without regard to whether they are interactive or not.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 12:27 PM
01-29-2002 12:27 PM
Re: creating menu prompts to source different .env files in .profile
An example attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 12:29 PM
01-29-2002 12:29 PM
Re: creating menu prompts to source different .env files in .profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2002 12:32 PM
01-29-2002 12:32 PM
Re: creating menu prompts to source different .env files in .profile
It looks like it works, but wanted to know what you guys thought...do I have one to many fi in there?
-joe
# Set up Oracle Applications environment:
if [ -t -eq 0 ]
then
echo "Which envionment?"
echo "1 for ORA"
echo "2 for APPS"
read userenv
if [ "$userenv" -eq 1 ]
then
. /k01/oracle/proddb/8.1.7/PROD.env
else
if [ "$userenv" -eq 2 ]
then
. /k02/oracle/prodappl/APPSORA.env
else
echo "stupid user - log them off"
fi
fi
fi