- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- setting the variable in the script
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
10-03-2007 06:50 AM
10-03-2007 06:50 AM
setting the variable in the script
I am setting a variable in the script and using it later to process something. When I echo the variable it has value. But actually when I use it looses it value. But when I harcoded the value instead of exported variable name it worked.
O.S IS hp-ux 11.23
Has anyone aware of this type of a problem?
EX: export JAVA_DIR=/opt/java1.4/jre
$JAVA_DIR does not work.
If I hard code /opt/java1.4/jre IT WORKS.
Thanks
Raji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2007 07:03 AM
10-03-2007 07:03 AM
Re: setting the variable in the script
# export JAVA_DIR=/opt/java1.4/jre
# echo $JAVA_DIR
/opt/java1.4/jre
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2007 07:13 AM
10-03-2007 07:13 AM
Re: setting the variable in the script
Can you please explain the problem more detailed ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2007 07:14 AM
10-03-2007 07:14 AM
Re: setting the variable in the script
"$JAVA_DIR" doesn't work? What are you expecting it to do and what if anything does "echo $JAVA_DIR" say?
If it's blank, are you:
Running a script then checking after it finishes? If so, I'd expect it not to be set, as you did it in a separate process and it went away when the script finished. the fix for this one "source" or "dot" the script when you run it. as in ". ./mystuff.sh"
Are you running a script that runs another script to set it. in this case, in the initial script, source or dot the second script as noted above
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2007 07:45 PM
10-03-2007 07:45 PM
Re: setting the variable in the script
please, post the peice of code that doesn't work to further help.
Rgds,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2007 08:52 PM
10-03-2007 08:52 PM
Re: setting the variable in the script
if you still facing the problem plese send the script
Regards
Prasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2007 08:54 PM
10-03-2007 08:54 PM
Re: setting the variable in the script
Hi Raji,
Plaese try like this
[root@steelmatrix ~]# export JAVA_DIR=/opt/java1.4/jre
[root@steelmatrix ~]# echo $JAVA_DIR
/opt/java1.4/jre
[root@steelmatrix ~]#
Regards
Prasanth