Get system command output: Difference between revisions

m
Fix Perl 6 -> Raku links
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (Fix Perl 6 -> Raku links)
Line 959:
=={{header|Raku}}==
(formerly Perl 6)
 
If you don't want to execute it in shell (and you probably don't), then use this:
<lang perl6>say run($command, $arg1, $arg2, :out).out.slurp-rest;</lang>
Line 968 ⟶ 969:
my $p2 = run 'cat', '-n', :in($p1.out), :out;
say $p2.out.slurp-rest;</lang>
See [http://doc.perl6raku.org/type/Proc docs] for more info.
 
If you really want to run something in shell and you understand potential security problems, then you can use <code>qx//</code> (interpolates environment variables) or <code>qqx//</code> (interpolates normally). See [http://doc.perl6raku.org/language/quoting the docs for more info].
 
<lang perl6>say qx[dir]</lang>
10,327

edits