- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Proper SYNTAX for EXPORTing variables
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
Discussions
Discussions
Forums
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
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-02-2010 06:37 AM
тАО12-02-2010 06:37 AM
ScritA calls ScriptB
In ScriptA
SERVER="mecury"
export SERVER
In ScriptB
echo $SERVER
And it prints nada.
What up?
Solved! Go to Solution.
- Tags:
- export
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-02-2010 07:00 AM
тАО12-02-2010 07:00 AM
Re: Proper SYNTAX for EXPORTing variables
Works for me...
$ cat A B
#!/bin/ksh
Server="mercury"
export Server
./B
#!/bin/ksh
echo $Server
$ ./A
mercury
You sure you're not stomping SERVER somewhere in ScriptB?
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-02-2010 07:14 AM
тАО12-02-2010 07:14 AM
Re: Proper SYNTAX for EXPORTing variables
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-02-2010 07:17 AM
тАО12-02-2010 07:17 AM
SolutionSource 'ScriptA' so that a separate environment isn't created for it:
# . ./ScriptA
# ./ScriptB
...or for that matter, *within* 'ScriptB' do:
...
. ./ScriptA
...
Note that shell sourcing is done with a dot, followed by whitespace, followed by the script name.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2010 12:55 PM
тАО12-03-2010 12:55 PM
Re: Proper SYNTAX for EXPORTing variables
>export SERVER
This is the old borne shell way of doing things. In a real shell you can use:
export SERVER="mecury"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2010 03:16 PM
тАО12-04-2010 03:16 PM
Re: Proper SYNTAX for EXPORTing variables
failing test case instead of a vague
description ("ScritA calls ScriptB", where
"calls" is not well defined) would make this
problem easier to diagnose with less reliance
on guesswork/intuition.
Just a thought.