jak skryt jakykoliv vystup na terminal

Dalibor Straka dast na panelnet.cz
Pondělí Říjen 24 02:00:46 CEST 2005


On Sun, Oct 23, 2005 at 01:44:14AM +0200, Premysl Hruby wrote:
> Oqak wrote:
> > Chci se zeptat, jak skryt jakykoliv vystup na terminal, z nasledujiciho
> > prikazu:
> > 
> > tar -C -xzf file.tar.gz 2> /dev/null
> > 
> > I kdyz top mam takto, tak to vraci:
> > 
> > tar: Removing leading '/' from member names
> > 
> 
> Mi se osvedcilo:
>  command 2>&1 > /dev/null
> nejdrive presmeruje stderr na stdout a potom stdout(tj. out+err) na
> /dev/null .
> 

Zpracovani presmerovani v prikazove radce je postupne zleva doprava.
Prosim venujte pozornost manualove strance bashe:

	Note that the order of redirections is significant.  For example,
	the command

		  ls > dirlist 2>&1

	directs both standard output and standard error to the file
	dirlist, while the command

		  ls 2>&1 > dirlist

	directs only the standard output to file dirlist, because the
	standard error  was  duplicated  as  standard  output
	before the standard output was redirected to dirlist.

-- Dalibor Straka


Další informace o konferenci Linux