SUMMARY[2]: PATH in shell script

From: Mike's List <mikelist_at_sky.net>
Date: Fri Jun 07 2002 - 16:34:22 EDT
*duh* on my part...you need to run the script as . ./path.ksh --should see
the path just fine on your current shell as well.  --so, the lesson is
don't forget that extra . (dot) . ./<script name>

Thanks again. (roughly a dozen of you responded w/the same suggestion)


- Mike

Brain not working, taking a break, grabbing food and caffein ;)


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

> 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
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri Jun 7 16:39:25 2002

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