[Glang-devel] リダイレクト'>&'でエラー

Back to archive index

Kazuharu Arakawa gaou****@sfc*****
2010年 4月 29日 (木) 14:14:52 JST


g.

変更しました。


On 2010/04/29, at 10:49, Haruo Suzuki wrote:

> 
> g-language-1.8.11/lib/Rcmd.pm
> 157行目
> . $this->{cmd} . " >& " . $this->{log});
>> . $this->{cmd} . " > " . $this->{log} . " 2>&1");
> に変更願います。
> 
>> explanations here:
>> https://wiki.ubuntu.com/DashAsBinSh
>> 
>> I think there is a bug somewhere in Rcmd.pm, which does not
>> support POSIX Shell, like line 156:
>> 
>>   system("/usr/bin/env R " . $this->{save} . " --slave < "
>>          . $this->{cmd} . " >& " . $this->{log});
>> 
>> should be
>> 
>>   system("/usr/bin/env R " . $this->{save} . " --slave < "
>>          . $this->{cmd} . " > " . $this->{log} . " 2>&1");
>> 
>> There might be other places like that.
> 
> 
>>>> ■'>&'でエラー
>>>> Ubuntu LinuxサーバでRcmd.pmを使用したところ、
>>>> sh: Syntax error: Bad fd number
>>>> というエラーが出力されたので、とりあえず
>>>> Rcmd.pmの162行目
>>>> 	   . $this->{cmd} . " >& " . $this->{log});
>>>> のリダイレクトを'>'に変更してエラーを回避しました。 
>>>> (または'2>&1')
>>>> 
>>> 2>&1を採用しました。
>> 
>> 
>> Rcmd.pmの162行目の
>>          . $this->{cmd} . " 2>&1 " . $this->{log});
>> リダイレクト(" > "、" >& "、" 2>&1 ")の 
>> 挙動を
>> 以下のスクリプトで確認したところ、
>> --------------------
>> use Rcmd;
>> my $rcmd = new Rcmd;
>> my @result = $rcmd->exec("c(1:10)");
>> print "print: @result \n";
>> --------------------
>> 
>> " > "と" >& "では、以下の正しい出力が得られますが、
>> --------------------
>> print: 1 2 3 4 5 6 7 8 9 10
>> --------------------
>> 
>> " 2>&1 "では、以下の出力が得られてしまいます。(@result 
>> が空)
>> --------------------
>> ARGUMENT '/tmp/6110325511.67064.log' __ignored__
>> 
>> [1]  1  2  3  4  5  6  7  8  9 10
>> print:
>> --------------------
> 
> _______________________________________________
> Glang-devel mailing list
> Glang****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/glang-devel




Glang-devel メーリングリストの案内
Back to archive index