Re: redirecting stdin and stdout to a file



On Wed, 27 Sep 2006 02:32:02 -0700, robannexs 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?

thanks in advance and best regards,
jackson

Curious kind of /dev/null you have, most people have one which has nothing
in it.

What you are doing is starting 'dd' in the background, then sending it a
signal. You are redirecting the output of the 'kill' command.

What you probably want is

dd if=/dev/zero of=/dev/null 2>abc.txt & pid=$!
kill -USR1 $pid
.



Relevant Pages

  • Re: redirecting stdin and stdout to a file
    ... i've been trying to redirect stderr and stdout to a file, ... i have also tried directing only the stdout to a file, ... Kill doesn't output anything (except maybe ... read discard && ...
    (comp.unix.shell)
  • Re: stderr and command substitution
    ... I want to run a command and assign any output to a variable. ... command is successful it outputs to stdout. ... If not, it outputs to stderr. ... Since I want to parse any of its output I need to redirect stderr to ...
    (comp.unix.shell)
  • redirecting stdin and stdout to a file
    ... i've been trying to redirect stderr and stdout to a file, ... i ran these command, ... somehow i still manage to get the output on screen; ... i have also tried directing only the stdout to a file, ...
    (comp.unix.shell)
  • Re: Redirecting STDOUT
    ... already told STDOUT will be redirected with ... $ command 1>file ... adding 2>&1 will also redirect STDERR to this file ... Running the same command as root, ...
    (freebsd-questions)
  • stderr and command substitution
    ... I want to run a command and assign any output to a variable. ... command is successful it outputs to stdout. ... If not, it outputs to stderr. ... Since I want to parse any of its output I need to redirect stderr to ...
    (comp.unix.shell)