Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site amdahl.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!harpo!decvax!decwrl!sun!amdahl!gam From: gam@amdahl.UUCP (G A Moffett) Newsgroups: net.wanted.sources,net.unix,net.bugs,net.sources Subject: use of wc(1) in shar packages Message-ID: <1661@amdahl.UUCP> Date: Thu, 13-Jun-85 23:26:16 EDT Article-I.D.: amdahl.1661 Posted: Thu Jun 13 23:26:16 1985 Date-Received: Sat, 15-Jun-85 08:33:13 EDT Distribution: net Organization: Blue Mouse Trailer Resort, Hellmouth, CA Lines: 25 Xref: watmath net.wanted.sources:971 net.unix:4789 net.bugs:644 net.sources:3004 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