[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
wc -l behaviour
- To: misc_(_at_)_openbsd_(_dot_)_org
- Subject: wc -l behaviour
- From: -f <f_(_at_)_obiit_(_dot_)_org>
- Date: Sat, 18 Dec 2004 00:38:09 +0100
- Mail-followup-to: misc_(_at_)_openbsd_(_dot_)_org
i am cooking a script and i need the number of rules present in pf.
my problem is with wc. i feel that it doesn't seem to follow the unix
philosophy truly. i would except that when telling wc to return
the number of lines of an output, it would do just that. but in
reality it returns whitespace AND the number:
kripel> sudo pfctl -s rules | wc -l
kripel> RULES=`sudo pfctl -s rules | wc -l`
kripel> echo $RULES
kripel> echo "$RULES"
kripel> echo "'$RULES'"
' 0 '
the last three commands are confusing for me. why is there
no whitespace w/o the quoting?
why the extra whitespace? could the behaviour be changed
that when one of -c, -l, -m, -w was specified, the whitespace
was trimmed? isn't that sensible?
to my embarrassment, i was born in bed with a lady!