This is strange...
M. Capron
mcapron at ektools.UUCP
Fri Dec 23 02:19:24 AEST 1988
Here is some bizareness I found. Below is a subset of a Bourne Shell script I
am writing on a Sun 3/60 running SunOS 4.0. This segment generates dependency
lists for makefiles. Note that the egrep brackets should contain a space and
a tab.
#!/bin/sh
for i in *.c
do
#Place a list of include files in $incs seperated by spaces.
#CODE A or CODE B goes here.
echo "$i : $incs"
done
CODE A: This works.
incs=`egrep '^#[ ]*include[ ]*"' $i | awk '{printf "%s ", $2}'`
incs=`echo "$incs" | sed 's/"//g'`
CODE B: This does not work.
incs=`egrep '^#[ ]*include[ ]*"' $i | awk '{printf "%s ", $2}' | sed 's/"//g'`
With CODE B, $incs comes out to be nil. I can't figure out what the difference
is, nor do I have the patience to play with it any furthing. I present it as an
oddity to any interested parties.
Sincerely,
Mike Capron
capron at chiron.UUCP
More information about the Comp.unix.wizards
mailing list