Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Dec 2007 10:52:04 +0300
From:      Michael Lednev <liettneff@bk.ru>
To:        jhall@vandaliamo.net
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Redirecting STDOUT
Message-ID:  <964986422.20071222105204@bk.ru>
In-Reply-To: <49457.65.117.48.155.1198258492.squirrel@admintool.trueband.net>
References:  <51935.12.170.206.13.1198248568.squirrel@admintool.trueband.net> <1044977630.20071221175247@bk.ru> <49254.65.117.48.155.1198256367.squirrel@admintool.trueband.net> <863400045.20071221201413@bk.ru> <49457.65.117.48.155.1198258492.squirrel@admintool.trueband.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello, jhall.

On 21 ??????? 2007 ?., 20:34:52 you wrote:

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

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

jvn> ls: /fjdkslafjdl: No such file or directory

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

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

jvn> Why does this not work as root?

Because default shell for root is csh. Try this

# command >& file

this will redirect both STDERR and STDOUT to file

-- 
Best regards,
 Michael                          mailto:liettneff@bk.ru




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?964986422.20071222105204>