Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-31-2005, 02:09 AM   #1
LQ Newbie
Registered: Jun 2002
Location: Slovak Republic
Distribution: RedHat, Mandrake, Gentoo
Posts: 25

Rep: Reputation: 15
export $PATH inside script

Is it possible to export PATH variable inside a running script?
I want to use extended PATH in parent bash shell by the script.
Old 01-31-2005, 06:44 AM   #2
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
No. There's no way a child process can affect the environment of the parent process. You'll need to directly issue the export command at the parent's prompt or source a file that contains the adjustments to PATH.
Old 01-31-2005, 08:04 AM   #3
LQ Newbie
Registered: Jun 2002
Location: Slovak Republic
Distribution: RedHat, Mandrake, Gentoo
Posts: 25

Original Poster
Rep: Reputation: 15

Old 02-01-2005, 08:34 AM   #4
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,420

Rep: Reputation: 198Reputation: 198
no can do.
exports work down, not up.

you can always dot the file though.
then it would work. (mind your exit statements though)

Or define a func, in your .profile say, eg:

     export PATH=doh
that'll work.
bash and korn of course!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PATH export in etc/profile.local adds dir twice tongar Linux - Newbie 3 06-16-2005 03:56 PM
'export PATH' does not work lemuel Linux - Newbie 7 01-30-2005 11:39 AM
export PATH disappears twallstr Linux - General 4 12-13-2004 02:57 AM
export in a script movitto Linux - Software 3 08-27-2004 12:37 AM
'export' from a script doesn't work, why? sylvain_gnu Debian 3 04-20-2004 12:42 PM

All times are GMT -5. The time now is 05:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration