[ale] STDOUT/STDERR redirection

Linux Idiot esoteric at atlnet.com
Wed May 6 08:13:25 EDT 1998


Glynn Black wrote:
> 
> I'm trying to use efax and gs from a perl script. The following code works but
> STDOUT and STDERR to either the console or file but not both. Is there some
> way to direct both to console and file simultaneously??? The code as is sends
> the output of efax to file. The ">&1" is an unsuccessful attempt to direct to
> screen. Script ignores it. None of my bash reference material gives an example
> to do this.

I have done this in the past with ksh:

# contents of file foo

#!/bin/ksh

exec 2>&1	# sends everything from stderr to stdout

date	# known command, generates stdout output
dte	# unknown command, generates stderr output

Execute foo this way:

foo | tee output_file_name

Maybe you can emulate this...????

> 
>         my ($phoneno, $fax_file) = @ARGV;
> 
>         my $the_fax = "efax -d /dev/cua3 -o1 -t " .
>                 "T$phoneno $fax_file.*" .
>                 ">&1" .
>                 "&>/home/blackgr/jobhunt/data/fax.log";
> 
>         system $the_fax;
> 
> Glynn Black     blackgr at worldnet.att.net

-- 
Until later: Geoffrey		esoteric at atlnet.com

NT is secure.... as long as you don't remove the shrink wrap.
Want to speed up your NT box real cheap?  Replace NT with Linux...






More information about the Ale mailing list