I-Appliance BBS
The Official Source for Internet Appliance Upgrades and Mods
Amazon Honor System Click Here to Pay Learn More
BBS Main List | Sign In | Sign Up | Search | Help | Linux-Hacker.netReply to Thread | Printer |

Home / Other I-Appliances / 3Com Audrey
export PATH=$PATH from shell script
Why doesn't export work in shell scripts?

New Messageexport PATH=$PATH from shell script (modified 0 times) Ray_Haque
Profile
One more question ... why is it that if I run this from pterm it works ...

export PATH=$PATH:/my/add/on

When I do the same thing in a shell script, it doesn't work. Try it, and you will see. Anyone know why? I have been told that its because when I run it in a script, the variable is not treated as a global one. But I have read instruction s on doing this for global defined variables.

I have tried this so many ways and it fails. If I type it out at pterm it sticks. The same thing put into an .sh file and it fails. Frustrating!

-Ray

02-23-2003 11:56:19

New MessageRE:export PATH=$PATH from shell script (modified 0 times) pedxing
Profile
Basic UNIX:

Use the dot operator to source a script rather than launching it as a child process.

In other words, do this to call your script:

# . ./foo.sh

instead of this:

# ./foo.sh

Keep on hacking!

Ped Xing

02-23-2003 18:08:48

New MessageRE:export PATH=$PATH from shell script (modified 0 times) sp15
Profile
Thank you!
I had been having this same problem. I 'knew' the answer, that the script needed to be sourced, but I didn't know to use the '.' command.
02-23-2003 20:21:32

New MessageRE:export PATH=$PATH from shell script (modified 0 times) Ray_Haque
Profile
Ah yes, that worked wonderfully. Thank you so much. That has been driving me crazy for DAYS. And every time one of my experiments caused a memory leak and I had to reboot Audrey, I would have to re-enter a long string of env variables. Now my script runs nicely.

Thanks!!!

-Ray

02-24-2003 13:52:41

New MessageRE:export PATH=$PATH from shell script (modified 0 times) pedxing
Profile
Glad to be of help! In return, I demand that you continue hacking your Audrey and continue sharing your results here!

Me? I just hosed mine up trying to add LibC to the .cmp directories without compressing it. I added it to boot.sh and rebooted... Uh oh! No boot! So I flashed an image from my OTHER Audrey and all's better. Live and learn...

PedXing

02-25-2003 15:36:46

Reply to Thread | Printer |
All times are PSTPowered by UltraBoard v1.62



Copyright © 2000, Netmake Inc. All Rights Reserved.
See Terms and Conditions for more information.




i-opener opener laptop notebook computer help drivers dll free windows dos repair fix linux mac macintosh 2000 95 98 nt pc configure hardware software sound video netscape explorer network networking lan wan software cmos fat bios printer card mouse modem ide scsi cd rom controllers scanner tape hard drive cgi scripts source code mp3