Am Son, 2002-07-14 um 21.55 schrieb Michael Hoeller:
Hallo Liste,
ich brauche Hilfe bei einem bash statement:
depmode -a > /dev/null 2>&1
Der linke Teil ist klar die Ausgabe wird auf /dev/null geleitet und wenn ich mich richtig erinnere dann steht 2 für die stderr d.h. also Fehler werden auf &1 geleitet und was ist das?? Gibt es auch &0 oder &2 ? Leider konnte ich keine Doku dazu finden, die es ganz sicher gibt - bin wohl noch nicht auf das richtige Schlagwort gekommen. Kann mir wer weiterhelfen?
Aus man bash: 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. Ergo ist depmode -a > /dev/null 2>&1 das gleiche wie depmode -a &> /dev/null nur anders geschrieben. Dabei werden stderr und stdout nach /dev/null umgeleitet. Ohne das "2>&1" würde stderr auf der Konsole landen und nicht in /dev/null -- Matthias Hentges [www.hentges.net] "Thats what sucks about windows, you can't say that you rooted some one. Saying "I ADMINISTRATORED YOU!" just doesnt sound cool."