change wc -l

Hi,

I would like realize a script that it can change " wc -l" with "wc -l | sed 's/ //g'", but my problem is that i can have
a pipe ,a variable ( many variable different) or a file after wc -l ?how i could test this several case ?

wc -l | cut -d' ' -f1`
if [ `wc -l <$FILE` -ne 1 ]
wc -l ${F} | awk '{print $1 }'

Thank you for your help.

I believe the function I posted earlier should work for all these cases.

Because I don't have the space problem, I made a slightly different wc function for testing here.

vnix$ type -all wc
wc is /usr/bin/wc
vnix$ wc () {
>   set -- `/usr/bin/wc "$@"`
>   echo $1
> }
vnix$ wc /etc/motd
8
vnix$ wc -l /etc/motd
8
vnix$ /usr/bin/wc /etc/motd
  8  50 338 /etc/motd
vnix$ wc -l </etc/motd | cut -d ' ' -f1
8
vnix$ if [ `wc -l </etc/motd` -eq 8 ] ; then echo foo ; fi
foo
vnix$ F=/etc/motd
vnix$ wc -l $F | awk '{ print $1 }'
8

Don't these cases work for you?