Note that bug-textutils is an obsolete address.  I have changed the
headers accordingly to [EMAIL PROTECTED]  Please followup there.

Herve Seignole wrote:
> I upgraded the wc tool. I added two commands :
> 
> - "-n", "--noname". This command don't print the filename

This is currently accomplished simply using a rederection from the
file.  This would be preferred for portability of scripts as it would
work with any 'wc' from any system.

  wc -l < file

> - "-s", "--nospace". This command don't use the "human
> readable function" and don't print spaces before each
> number.

That is already the default behavior in the current coreutils.  It
changed in coreutils-5.0.90 (2003-07-29).

  wc -l < /dev/null
  0

No spaces are printed.  However you might find this previous message
useful.  (Summary, I argue that one should not count on this because
other systems still print spaces.)

  http://lists.gnu.org/archive/html/bug-textutils/2002-11/msg00000.html

It seems you have an old version of the code base.  The current code
base is here:

STABLE
  ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.2.1.tar.gz
  ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.2.1.tar.bz2

BETA
  ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.gz
  ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.bz2

The current daily CVS of the source code is available from savannah.

  http://savannah.gnu.org/cvs/?group=coreutils

> These evolutions are useful for me especially if I would like
> to use wc in "if condition" (shell script).
> 
> Exemple :
> 
> if [ `wc -l -n foo.txt` = 1 ]
> then
> echo "here"
> fi

There are many different ways to do this.  Remembering that "=" is a
text comparison and that "-eq" is a numeric comparison let me suggest
this:

  if [ `wc -l < foo.txt` -eq 1 ]
  then
    echo "here"
  fi

I think that reads best.  It is still possible to do text comparisons:

  if [ x`wc -l < foo.txt | tr -d ' '` = x1 ]

Bob


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to