- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- PATH variable and batch
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
тАО02-09-2006 02:24 AM
тАО02-09-2006 02:24 AM
PATH variable and batch
If i type PATH=opt/wotever:$PATH, the path changes. I can confirm this using echo $PATH.
If i execute a batch file, usingg the same command, it does not work, the PATH remains the same.
What am I missing???????????
TIA Ian
- Tags:
- PATH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2006 02:34 AM
тАО02-09-2006 02:34 AM
Re: PATH variable and batch
I think, you have export with full path not relative. When you execute a script or batch file, it spawns a shell and export PATH to that particular child shell, when it finishes execution, PATH will be no longer available to parent.
Hope this is clear.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2006 02:35 AM
тАО02-09-2006 02:35 AM
Re: PATH variable and batch
PATH=/opt/wotever:${PATH}
export PATH
or combine in 1 statement:
export PATH=/opt/wotever:${PATH}
I assume the missing leading "/" before "opt" was a typo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2006 02:39 AM
тАО02-09-2006 02:39 AM
Re: PATH variable and batch
Ta.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2006 02:41 AM
тАО02-09-2006 02:41 AM
Re: PATH variable and batch
I'll assume that you are setting PATH in something like myvars.sh
echo "Before: ${PATH}"
myvars.sh
echo "After : ${PATH}" # these will be the same
The "trick" is to source your script via the "dot" operator so that it becomes a part of the current process.
echo "Before: ${PATH}"
. myvars.sh
echo "After : ${PATH}" # these will different
When myvars.sh is sourced it must not contain an exit or return statement because now you will exit the foreground process.