Re: sed? insanity
>>>>> "Clint" == Clint Adams <email@example.com> writes:
A better title would be "make makes sed insane".
I don't know exactly what is wrong, but can tell you how to
fix it ;-)
I will leave it up to you if you want to trust my solution or not...
Clint> This is driving me batty. Can anyone tell me what's broken here?
Clint> % ./shtest weird
Clint> t: s,$,weird,
Clint> s: TESTweird
Clint> % make -f maketest test
Clint> t: make: Entering directory `/tmp'
Clint> make: Leaving directory `/tmp'
Clint> sed: -e expression #1, char 1: Unknown command: ``m''
Clint> # shtest
Clint> t=`make -f - <<EOF
Clint> @echo $weird
Clint> echo "t: $t"
To fix the problem:
1. put t="" before sed command. This fixes the problem, even with
2. Put "unset MAKELEVEL" before the sed command - at least this fixes
the problem for me.
3. Put "export MAKELEVEL=1" before the sed command - now
it crashes every time!!! (See below)
Clint> s=`echo TEST | sed -e "$t"`
Clint> echo "s: $s"
Clint> # maketest
Clint> @./shtest 'weird'
 [snoopy:bam] ~ >./shtest
t: make: Entering directory `/homes/bam'
make: Leaving directory `/homes/bam'
sed: -e expression #1, char 1: Unknown command: ``m''
sh -x shtest,
it would appear that sed is running a copy of make,
but I don't know why.
Arrghh... I see your problem. I think it is related to the
following prompts from Make:
make: Leaving directory ...
make: Entering directory ...
which somehow confuse sed. Or perhaps the shell is getting
confused, and mangles the result before sed sees it.
Brian May <firstname.lastname@example.org>