Re: sed? insanity
Clint Adams <schizo@debian.org> writes:
> This is driving me batty. Can anyone tell me what's broken here?
>
> % ./shtest weird
> t: s,$,weird,
> s: TESTweird
> % make -f maketest test
> t: make[1]: Entering directory `/tmp'
> s,$,weird,
> make[1]: Leaving directory `/tmp'
> sed: -e expression #1, char 1: Unknown command: ``m''
> s:
>
> -----8<-----
> #!/bin/sh
> # shtest
>
> weird="s,\$\$,$1,"
>
> t=`make -f - <<EOF
> all:
> @echo $weird
> EOF`
>
> echo "t: $t"
>
> s=`echo TEST | sed -e "$t"`
>
> echo "s: $s"
> -----8<-----
> #!/usr/bin/make
> # maketest
>
> test:
> @./shtest 'weird'
> -----8<-----
Behaves just as it should.
As your output shows
t="make[1]: Entering directory `/tmp'
s,$,weird,
make[1]: Leaving directory `/tmp'"
and thus sed -e "$t" evaluates to:
sed -e "make[1]: Entering directory `/tmp'
s,$,weird,
make[1]: Leaving directory `/tmp'"
and m is not a proper command for sed.
Your problem is the extra output make generates when calling make
again.
May the Source be with you.
Goswin
Reply to: