Submission for Unix-PC

gatelist at zorch.SF-Bay.ORG gatelist at zorch.SF-Bay.ORG
Tue Dec 12 21:21:38 AEST 1989


Regarding "make" and input/output redirection

I want to tee make output to a logfile.  But a function in the Makefile 
doesn't like the way I'm redirecting output.  Command 1 works, 2
doesn't ("sh: test: argument expected").

1. $ make su_bin
2. $ make su_bin 2>&1 | tee logfile

Here's the Makefile excerpt:

su_bin:	
# if not user bin, then abend
	if [ `ps -f | \
	        awk '$$2==PID {print $$1}' PID=$$$$ -` != bin ]; then \
	    echo "Makefile: su bin before making" >&2; \
	    exit 2; \
	fi

This question was posed to a friend using HP-UX, who said
> I ran your makefile here and it works with and without the
> redirection.  So I can't duplicate the problem.  I can speculate
> that the awk script is not getting any input because the redirection
> and the reference to '-' in the makefile confuse things on your
> system.  Why not just use 'whoami' in the makefile?

But of course, we do not have whoami, and I replied
> "su" (on my system) will not make an entry in /etc/utmp, the file "who"
> and "who am i" normally examine.  Instead, "su" makes an entry in
> /usr/adm/sulog.  For that reason, "who am i" will not reflect the user
> one is "su"ed to.

Any suggestions or enlightening comments would be greatly appreciated.
(am using 3.51 OS, 3.5 development set)

John R Ruckstuhl, Jr, ...!hplabs!hp-lsd!sphere!ruck



More information about the Unix-pc.general mailing list