Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!ucsd!pacbell.com!pacbell!sactoh0!jak From: jak@sactoh0.UUCP (Jay A. Konigsberg) Newsgroups: comp.unix.questions Subject: Re: edit file that invoked script while executing Keywords: sh, Makefile, userid Message-ID: <3519@sactoh0.UUCP> Date: 13 Jul 90 19:25:49 GMT References: <18994@well.sf.ca.us> Reply-To: jak@sactoh0.UUCP (Jay A. Konigsberg) Distribution: usa Organization: SAC-UNIX, Sacramento, Ca. Lines: 30 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.