Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-Id: <5.1.0.14.2.20020313084036.00abc1c8@pop3.cris.com> X-Sender: rrschulz AT pop3 DOT cris DOT com X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 13 Mar 2002 08:50:28 -0800 To: "Robert Mark Bram" , cygwin AT cygwin DOT com From: Randall R Schulz Subject: Re: IO Redirection In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Robert, [ Yes, Bjoern, this is OT for the Cygwin list as it's all about shell usage and not at all Cygwin specific. ] You're using BASH, Robert. Except for the simple ">" and ">>" redirection, it's syntax is different from that of TCSH. Bjoern's answer was for TCSH. I'm a BASH user, so I'll answer for that shell. # Simple redirection of standard output only, overwriting existing file, if any: % echo "foo is bar" >fbfile # Appending redirection % echo "foo is more bar" >>fbfile # Redirect standard error only % command-that-generates-error-output arg1 arg2 2>error-output # Redirect standard output and standard error separately % command arg >stdout 2>stderr # Merge standard error with standard output # Order of redirection operators IS significant % command arg1 arg2 >merged-output 2>&1 All the output redirections can be doubled for appending, but that does not apply to the descriptor merging forms (e.g., 2>&1, which means merge descriptor 2 with the current descriptor 1 and works for any number greater than 0). Good luck. Get a good tutorial that covers BASH. Randall Schulz Mountain View, CA USA At 02:54 2002-03-13, Robert Mark Bram wrote: >Thanks for the reply! > >> > How do I append error output? >> > How do I append error and standard output? >> >> Just as you have written? >> ">>" appends, ">" write to a new file, independend of the file >> or source selected. That is, "&>>file" appends both. >> >> Why is that not obvious ? > >This is why: > >Robert Mark Bram AT DIJONG ~ >$ ls >errors script1 script2 temp > >Robert Mark Bram AT DIJONG ~ >$ ls &>> temp >bash: syntax error near unexpected token `&>>' > >Robert Mark Bram AT DIJONG ~ >$ > >Rob -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/