[comp.unix.questions] edit file that invoked script while executing

gregs@well.sf.ca.us (Greg Strockbine) (07/13/90)

What I'm looking for here is a general approach and a couple of
specifics. 
I have a bourne shell script that is invoked from within a 
Makefile. How in the bourne shell can I get the userid of
the person who inovked the make?
I then want to locate the Makefile and remove the dependency 
from the 'all' target that caused the script to be invoked.
So how do I determine the path of the Makefile?
	thanx in advance, greg s., dataproducts, woodland hills, ca.

jak@sactoh0.UUCP (Jay A. Konigsberg) (07/14/90)

In article <18994@well.sf.ca.us> gregs@well.sf.ca.us (Greg Strockbine) writes:
>What I'm looking for here is a general approach and a couple of
>specifics. 
>I have a bourne shell script that is invoked from within a 
>Makefile. How in the bourne shell can I get the userid of
>the person who inovked the make?

UID=`id | cut (some directives)` # is one way, there are others.

>I then want to locate the Makefile
Assuming nobody is using absolute path names or changing directories in
the code:

PATH=`pwd`

Otherwise, you'll need code in the Makefile that determins the PATH from
a shell command within make(1).

>				    and remove the dependency 
>from the 'all' target that caused the script to be invoked.

Well, I suppose sed/ed scripts would work, but I was always taught that
programs that change their own code was a bad idea. Instead, you set
flags that tell the code to skip sections.


-- 
-------------------------------------------------------------
Jay @ SAC-UNIX, Sacramento, Ca.   UUCP=...pacbell!sactoh0!jak
If something is worth doing, its worth doing correctly.