- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- why do you export a variable ?
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
02-04-2007 03:14 PM
02-04-2007 03:14 PM
thanks to all of those who spend few time to reply my answer.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2007 03:15 PM
02-04-2007 03:15 PM
Re: why do you export a variable ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2007 03:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2007 03:39 PM
02-04-2007 03:39 PM
Re: why do you export a variable ?
I think after export a variable it will become as a environmental veriable. So ur child process also will inherits this variable.
Rgds,
Guna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2007 04:05 PM
02-04-2007 04:05 PM
Re: why do you export a variable ?
export is a command that sets environment variables for use for the entire duration of the session, unless changed. export is usually a shell built-in command.
For example, if you have 3 scripts to run simultaneously at the command line and all the 3 scripts need the same environment variables. You can just export the variables prior to the execution of script and just use it in the three scripts. This way your script becomes simpler too!
hope this helps!
Kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2007 08:01 PM
02-04-2007 08:01 PM
Re: why do you export a variable ?
varname=value
the varname is accessible in the shell only (local variable).
If you define it as
export varname=value,
the variable is accessible for the shell children as well.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2007 08:40 PM
02-04-2007 08:40 PM
Re: why do you export a variable ?
The reason is related to 'scope' of the variable. As analogy, it can be compared (loosely though) with scope of a variable in programming language. To summerize, the 'scope' of the variable is limited to the shell (as rightly informed) and when exported the 'scope' extends upto the session.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2007 09:46 PM
02-04-2007 09:46 PM
Re: why do you export a variable ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2007 12:48 AM
02-05-2007 12:48 AM
Re: why do you export a variable ?
set
env
The first shows your shell's total variable list but env shows only the exported variables.
Bill Hassell, sysadmin