On Dec 21, 2007, at 10:34 AM, [EMAIL PROTECTED] wrote:


In that case you only redirecting STDERR to file. As you've been
already told STDOUT will be redirected with

$ command 1>file

or

$ command > file

adding 2>&1 will also redirect STDERR to this file


When I run this as a non-root user it works fine. But, when running it as
root, it does not produce the expected results.

$ ls -l /fjdkslafjdl 2>/home/hallja/test2
And, in the file test2, I see

ls: /fjdkslafjdl: No such file or directory

Running the same command as root, I receive the following results.
# ls -l /fjdkslafjdl 2>/home/hallja/test2
ls: /fjdkslafjdl: No such file or directory

And, in /home/hallja/test2 I see the following.
-rw-r--r--  1 root  hallja  0 Dec 21 08:02 2

Why does this not work as root?


When you are root type in

  # echo $SHELL

Unless you previously invoked /bin/sh

  # sh

you are almost certainly running csh

Dan

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to