[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wc -l behaviour



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