shell当我在调用程序中更改标准文件句柄时,我正在玩它以及它是如何动作的.Proc说:
$ in,$ out和$ err是待启动程序的三个标准流,默认为" - ",这意味着它们从父进程继承流.
据我所知,外部程序不使用相同的文件句柄:
#!/Applications/Rakudo/bin/perl6
#`(
make an external Perl 6 program the outputs to standard handles
)
my $p6-name = 'in-out.p6'.IO;
#END try $p6-name.unlink; # why does this cause it to fail?
my $p6-fh = open $p6-name, :w;
die "Could not open $p6-name" unless ?$p6-fh;
$p6-fh.put: Q:to/END/;
#!/Applications/Rakudo/bin/perl6
$*ERR.say( qq/\t$*PROGRAM: This goes to standard error/ );
$*OUT.say( qq/\t$*PROGRAM: This goes to standard output/ );
END
$p6-fh.close;
say $p6-name.e ?? 'File is there' …Run Code Online (Sandbox Code Playgroud) Perl 6的shell将命令发送到"shell",但没有说明是什么.我一直在我的机器上打击,但我不知道我是否可以依赖它.
$ perl6 -e 'shell( Q/echo $SHELL/ )'
/bin/bash
$ csh
% perl6 -e 'shell( Q/echo $SHELL/ )'
/bin/bash
% zsh
$ perl6 -e 'shell( Q/echo $SHELL/ )'
/bin/bash
Run Code Online (Sandbox Code Playgroud)
在文档记录的时候,在Unix上这很容易,但是Windows上的cmd.exe或PowerShell(或者如果安装了bash)呢?我认为这是cmd.exe,但记录的答案会很好.