[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wc -l behaviour
- To: misc_(_at_)_openbsd_(_dot_)_org
- Subject: Re: wc -l behaviour
- From: Matthias Kilian <kili_(_at_)_outback_(_dot_)_escape_(_dot_)_de>
- Date: Sat, 18 Dec 2004 07:57:02 +0100
- Mail-followup-to: misc_(_at_)_openbsd_(_dot_)_org
On Sat, Dec 18, 2004 at 01:04:25AM +0100, Paul de Weerd wrote:
> | kripel> sudo pfctl -s rules | wc -l
> | 0
> | kripel> RULES=`sudo pfctl -s rules | wc -l`
> | kripel> echo $RULES
> | 0
[...]
> That's echo for you. echo(1) will simply return the arguments passed
> to it on the commandline separated by a single space, with all other
> IFS[1] removed. The shell-builtin echo also does this. Your first
> incarnation echoes $RULES, which expands to ' 0 '. echo strips
> all unnecessary whitespace and displays the only non-whitespace
> argument.
Not quite correct; we're not running DOS. It's the shell that does
globbing and tokenization.
So, you can allways let the shell do the job, for example:
$ set `ls | wc -l`
$ echo "-$1-"
-72-
Ciao,
Ki "nitpicker" li
Visit your host, monkey.org