Re: redirecting stdin and stdout to a file
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- Date: 27 Sep 2006 10:37:03 GMT
On 27 Sep 2006 02:32:02 -0700, robannexs@xxxxxxxxx wrote:
hi,[...]
i've been trying to redirect stderr and stdout to a file,
i ran these command,
dd if=/dev/null of=/dev/null &pid=$!
kill -USR1 $pid > abc.txt 2>&1
somehow i still manage to get the output on screen;
19755503+0 records out
10114817536 bytes (10 GB) copied, 122.91 seconds, 82.3 MB/s
i have also tried directing only the stdout to a file, and only stderr
to a file, with both bearing similar results as above. why is it so? is
there somethign else that will print to screen other than these 2?
You're redirecting kill's standard output and standard error to
abc.txt, not dd's. Kill doesn't output anything (except maybe
for some error messages when it doesn't manage to send a signal
to another process)
And it's strange that dd would manage to read something from
/dev/null (wasn't it if=/dev/zero?).
dd if=/dev/zero of=/dev/null 2> abc.txt &
kill -USR1 "$!"
{
(
trap : INT # revert the ignoring of SIGINT by the shell
# (sigh) for CTRL-C handling
exec dd if=/dev/zero of=/dev/null 2>&1
) &
echo "$!"
} | {
read pid &&
while sleep 1; do
kill -USR1 "$pid"
read discard &&
read discard &&
read bytes discard || break
echo "$bytes bytes copied so far"
done
}
--
Stephane
.
- References:
- redirecting stdin and stdout to a file
- From: robannexs
- redirecting stdin and stdout to a file
- Prev by Date: Re: Grep can find a pattern in a text, but not in a file
- Next by Date: simple alias doesn't work
- Previous by thread: Re: redirecting stdin and stdout to a file
- Next by thread: simple alias doesn't work
- Index(es):
Relevant Pages
|