SUMMARY: PATH in shell script

From: Mike's List <mikelist_at_sky.net>
Date: Fri Jun 07 2002 - 15:04:31 EDT
I think Alex might have it down...I added -x (as recommended) and it seems
the PATH is executing just fine...however, after the script ran, I did an
echo $PATH (which the old PATH) displays something else...you can not
export "upward" to the parent shell  --only downward (forgot about this).

So after the script ran, I still have the OLD path and was puzzling if the
script even execute at all, hence, the test of the PATH statement alone in
a seperate script to test the PATH.

Thanks all, hope the above/below makes sense? can't export UP only DOWN.


- Mike

# ./path.ksh
+ echo \n--- Setup Path ---

--- Setup Path ---
+ PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/ucb:/etc
+ export PATH

# echo $PATH
/usr/sbin:/usr/bin


From: "Pleszko, Alex" <alex.pleszko@eds.com>
To: Mike's List <mikelist@sky.net>
Subject: RES: PATH in shell script


I can't tell you for sure but i think this is your problem:

The variable is valid within the shell execution. When you execute a script
in a shell prompt, another shell process (ksh in your case) is started and
new environments variables are set. When the script finishes the related
process is ended, so the variables are lost.



On Fri, 7 Jun 2002, Mike's List wrote:

> Maybe my brain is not working today, this is what I have in my script
> 
> #!/bin/ksh
> PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/ucb:/etc
> export PATH
> 
> I need to setup the PATH for the rest of my script to run...but the
> above doesn't seems to do it...however, when I execute the same line
> above at the prompt PATH works fine.  What the heck am I doing wrong
> in my script???
> 
> 
> 
> - Mike
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri Jun 7 15:10:12 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:46 EST