[net.sources] use of wc

gam@amdahl.UUCP (G A Moffett) (06/14/85)

Some shar archives use wc(1) to check the character count of
a file to ensure that the whole file was transmitted.  The
usage is something like this:

	if [ 1285 -ne `wc -c foo.c` ]
	then
		echo "foo.c didn't make it (should have been 1285 chars)"
	fi

I don't know which flavor of Unix you are using, but this fails
horribly under System V, whose wc(1) prints both the file name
and the number of chars.  The error is 'test: bad number'.
Rather than argue the virtues of one Unix version over another,
let me suggest a portable alternative:

	wc -c < foo.c

Yes, the simple addition of '<' will allow System V's wc(1) to
print just the char count, and certainly your flavor will do the
same thing.  Please change your shar(1) script/program accordingly.

Thank you for your attention, and now back to netnews, which is
already in progress....
-- 
Gordon A. Moffett               ...!{ihnp4,cbosgd,sun}!amdahl!gam