bluebox% ls -al 2>&1 > ~/output.file
Ambiguous output redirect
Met csh dien je idd te gebruiken:
bluebox% SunOS bluebox 5.6 Generic_105181-06 sun4u sparc SUNW,Ultra-4
bluebox% ls >& textfile.output
bluebox% head -n3 textfile.output
[snip]
(zie verder de manpages)
Hier nog een handig overzichtje:
(ugh layout pakt ie niet)
Send stdout to file
csh: prog > file
sh: prog > file
Send stderr to file
sh: prog 2> file
Send stdout and stderr to file
csh: prog >& file
sh: prog > file 2>&1
Take stdin from file
csh: prog < file
sh: prog < file
Send stdout to end of file
csh: prog >> file
sh: prog >> file
Send stderr to end of file
sh: prog 2>> file
Send stdout and stderr to end of file
csh: prog >>& file
sh: prog >> file 2>&1
Read stdin from keyboard until c
csh: prog <<c
sh: prog <<c
Pipe stdout to
csh: prog2 prog | prog2
sh: prog | prog2
Pipe stdout and stderr to prog2
csh: prog |& prog2
sh: prog 2>&1 | prog2
While standard I/O is a basic feature of UNIX, the syntax used to redirect standard I/O depends on the shell you are using. Bourne shell syntax and C shell syntax differ, particularly when you get into the less commonly used features. The Korn shell and bash are the same as the Bourne shell, but with a few twists of their own.
The C shell doesn't give you an easy way to redirect standard output without redirecting standard error. A simple trick will help you do this. To put standard output and standard error in different files, give a command like:
% ( prog > output ) >& errors
/me gaat nu maar weer eens verder met studeren ipv Got'en
[
Voor 109% gewijzigd door
Verwijderd op 29-11-2002 12:41
]