Re: echo to stderr

From: Bill Verzal (BVerzal@KOMATSUNA.COM)
Date: Wed Aug 20 2003 - 09:01:04 EDT


Ahh yes - but my original post called for not using shell redirects.

Thanks - BV :)
--------------------------------------------------------

Bill Verzal
AIX Administrator, Komatsu America
(847) 970-3726 - direct
(847) 970-4184 - fax

|---------+---------------------------->
| | Aaron Morris |
| | <aaronmorris@MIND|
| | SPRING.COM> |
| | Sent by: IBM AIX |
| | Discussion List |
| | <aix-l@Princeton.|
| | EDU> |
| | |
| | |
| | 08/19/2003 05:45 |
| | PM |
| | Please respond to|
| | IBM AIX |
| | Discussion List |
| | |
|---------+---------------------------->
>-------------------------------------------------------------------------------------------------------------------------------|
  | |
  | To: aix-l@Princeton.EDU |
  | cc: |
  | Subject: Re: echo to stderr |
>-------------------------------------------------------------------------------------------------------------------------------|

Jim McDonald wrote:
> Hi
>
>
> #!/usr/bin/perl
> my $input = <STDIN> ;
> print STDERR "$input" ;
>
>
> Regards
> Jim McDonald

Actually it would be:

#!/usr/bin/perl
print STDERR @ARGV;
print STDERR "\n";

but you would have to run it like `script.pl "Text to STDERR"` so that
the entire text is placed in the first element of the array. Otherwise
spacing is lost.

Using perl would probably be a little :-) more memory intensive than a
simple C program.

I just though of a shell script that should work:

#!/usr/bin/ksh
exec 1>&2
echo $@

--
Aaron W Morris <aaronmorris@mindspring.com> (decep)


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:09 EDT