Search this site
powered by FreeFind |
|
[root@server /root]# ./cmd 1>out.txt 2>err.txt |
[root@server /root]# ./cmd 1>>out.txt 2>>err.txt |
[root@server /root]# (((./cmd | tee stdout.txt) 3>&1 1>&2 2>&3\ |tee stderr.txt) 3>&1 1>&2 2>&3) 1>out.txt 2>err.txt |
[root@server /root]# (cd /var/ftp/pub/rh71prof/disk1.iso.dir \ && tar -cvf - .) | (cd /var/ftp/pub/rh71prof/i386 && tar -xvf -) |
[root@server /root]# find . -type f -exec grep -i \ searchstring \{\} --with-filename \; |
#!/bin/sh #You can use this sample script for testing. The echo # statements explain how this script works. echo "This is Standard Out" >&1 echo "This is Standard Error" >&2 |
echo Standard Out >stdout.txt echo Standard Error >stderr.txt for X in bzImage modules modules_install; do make $X; done 1>>stdout.txt 2>>stderr.txt |
[root@server /root]# cmd | tee tee.txt |
[root@server /root]# cmd | tee -a tee.txt |
[root@server stdout]# script Script started, file is typescript [root@server stdout]# ./cmd This is Standard Out This is Standard Error [root@server stdout]# exit exit Script done, file is typescript [root@server stdout]# cat typescript Script started on Thu Oct 11 11:47:36 2001 [root@server stdout]# ./cmd This is Standard Out This is Standard Error [root@server stdout]# exit exit Script done on Thu Oct 11 11:47:39 2001 [root@server stdout]# |
[root@server /root]# cmd 2>&1 1>outfile.txt |
[root@server /root]# cmd 1>outfile.txt 2>&1 |
[root@server /root]# (((./cmd | tee stdout.txt) 3>&1 1>&2 2>&3 \ | tee stderr.txt) 3>&1 1>&2 2>&3) 1>out.txt 2>err.txt |
#!/bin/sh #You can use this sample script for testing. The echo # statements explain how this script works. echo "This is Standard Out" >&1 echo "This is Standard Error" >&2 |
[root@server /root]# ./cmd This is Standard Out This is Standard Error [root@server /root]# |
[root@server /root]# ./cmd | tee stdout.txt |
[root@server /root]# (./cmd | tee stdout.txt) |
[root@server /root]# (./cmd | tee stdout.txt) 3>&1 1>&2 2>&3 |
[root@server /root]# (./cmd | tee stdout.txt) 3>&1 1>&2 2>&3 \ | tee stderr.txt |
[root@server /root]# ((./cmd | tee stdout.txt) 3>&1 1>&2 2>&3 \ | tee stderr.txt) |
[root@server /root]# ((./cmd | tee stdout.txt) 3>&1 1>&2 2>&3 \ | tee stderr.txt) 3>&1 1>&2 2>&3 |
[root@server /root]# (((./cmd | tee stdout.txt) 3>&1 1>&2 2>&3 \ | tee stderr.txt) 3>&1 1>&2 2>&3) |
[root@server /root]# (((./cmd | tee stdout.txt) 3>&1 1>&2 2>&3 \ | tee stderr.txt) 3>&1 1>&2 2>&3) 1>out.txt 2>err.txt |
[root@server /root]# ./cmd 1>out.txt 2>err.txt |
Here is our testing command we will use to generate both stderr and stdout on proper channels: root@server:~> (echo out >&1; echo err >&2) out err And here is the command to do the work: root@server:~> (((echo out >&1; echo err >&2) 3>&2 2>&1 1>&3 | \ tee stderr.txt ) 3>&2 2>&1 1>&3 ) > combined.txt 2>&1 root@server:~> cat stderr.txt err root@server:~> cat combined.txt out err root@server:~> |
Search this site
powered by FreeFind |
|