Shell : quick newb question - redirecting to file

Colin Watson cjwatson at ubuntu.com
Tue Jul 12 13:23:08 UTC 2005


On Tue, Jul 12, 2005 at 03:43:54PM +0300, ZIYAD A. M. AL-BATLY wrote:
> On Tue, 2005-07-12 at 12:34 +0100, Colin Watson wrote:
> > If you want to redirect both stdout and stderr to a file, use this
> > instead:
> > 
> >   programName >outputFile 2>&1
> 
> Or a special "short cut" that do the same thing as above:
>     programName &>outputFile

Yes, but beware that that doesn't work in all POSIX shells (so you can
rely on it if you're using bash, but not if you're writing /bin/sh
scripts).

Cheers,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list