Skip to main content
added missing quotes
Source Link
Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k

I don't think you can suppress the total in the multi-argument form.

The simplest way I can think of is to stick to the one-argument form, when needed:

if [ $#"$#" -lt 5 ]
then
    for f in $@;"$@"; do wc -l $f;-- "$f"; done >>$1>>"$1"
else
    wc -l $@"$@" >> $1"$1"
fi

I don't think you can suppress the total in the multi-argument form.

The simplest way I can think of is to stick to the one-argument form, when needed:

if [ $# -lt 5 ]
then
    for f in $@; do wc -l $f; done >>$1
else
    wc -l $@ >> $1
fi

I don't think you can suppress the total in the multi-argument form.

The simplest way I can think of is to stick to the one-argument form, when needed:

if [ "$#" -lt 5 ]
then
    for f in "$@"; do wc -l -- "$f"; done >>"$1"
else
    wc -l "$@" >> "$1"
fi
Source Link
nlu
  • 791
  • 5
  • 5

I don't think you can suppress the total in the multi-argument form.

The simplest way I can think of is to stick to the one-argument form, when needed:

if [ $# -lt 5 ]
then
    for f in $@; do wc -l $f; done >>$1
else
    wc -l $@ >> $1
fi