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

Re: Bash equivalent to DOS /p




Elijah
That works for regular output.  However, some programs also emit
error messages onto stderr.  The above command will *not* redirect
error messages into less, so they might mess up the pagination.
To get error messages piped through less, use

	command 2>&1 | less

dude! i've been trying to do that for months.  tahnks!

as an aside, did /p in DOS redirect stderr, too?  it's been so long
...
slash-p is specific to the dir command. DOS also has more.

I'm more familiar with OS/2 where one has to redirect stderr as in the example above. I believe that's also true on Windwoes.

I suppose for completeness we should mention tee.

tee writes its stdin to a file (which you name on the commandline) and to stdout. It's useful for keeping a record of events.

$ apt-get -b source kernel-image-2.6.6-1-386 2>&1 | tee building-kernels

We've also mentioned redirection. These two are different:
$ apt-get -b source kernel-image-2.6.6-1-386 >one 2>&1
$ apt-get -b source kernel-image-2.6.6-1-386 2>&1 >one

This can be handy too::
$ apt-get -b source kernel-image-2.6.6-1-386 >one 2>two

and there's always this:

$ apt-get -b source kernel-image-2.6.6-1-386 >>one 2>>two

I'll leave you to RTFM to discover what these do and whether I've made any mistakes:-)


--

Cheers
John

-- spambait
1aaaaaaa@computerdatasafe.com.au  Z1aaaaaaa@computerdatasafe.com.au
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/



Reply to: