[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: writing to /dev/stderr



On Fri, 30 Aug 1996, Alex Romosan wrote:

> i am trying to print to /dev/stderr from within gawk 
> (print $0 > "/dev/stderr") but i get the following error:
> 
> gawk: cmd. line:30: (FILENAME=- FNR=1) fatal: can't redirect to
> `/dev/stderr' (Permission denied)

That should work, for example
	gawk '{print $0 > "/dev/stderr";}'
copies its input to stderr.

It's not a permissions problem; /dev/std{in,out,err} and /dev/fd/n are
implemented internally by gawk.  They're not really files on the
system.  Well, actually /dev/fd/n really is a symlink into the /proc
filesystem, but gawk isn't using it.

Is your gawk really gawk, not an alias for nawk or something?  I'm not
sure if those files are supported by nawk.

You could also use /dev/fd/2 which will use the /proc system.


Guy



Reply to: