head behaviour

Brian Somers brian at FreeBSD.org
Mon Jun 7 23:14:08 UTC 2010


On Mon, 07 Jun 2010 13:05:48 +0200, Dag-Erling Smørgrav <des at des.no> wrote:
> Bakul Shah <bakul at bitblocks.com> writes:
> > Except read doesn't do it quite right:
> >
> > $ ps | (read a; echo $a ; grep zsh)
> > PID  TT  STAT      TIME COMMAND
> 
> yeah, I forgot that it drops leading whitespace...

Well, leading $IFS

    $ ps | (IFS= read a; echo "$a"; grep zsh)

works a lot better.

-- 
Brian Somers                                       <brian at Awfulhak.org>
Don't _EVER_ lose your sense of humour !            <brian at FreeBSD.org>


More information about the freebsd-hackers mailing list