syntax qqx

Documentation for syntax qqx assembled from the following types:

language documentation Quoting constructs

From Quoting constructs

(Quoting constructs) quote qqx qqx

If one wishes to use the content of a Raku variable within an external command, then the qqx shell quoting construct should be used:

my $world = "there";
say qqx{echo "hello $world"};  # OUTPUT: «hello there␤»

Again, the output of the external command can be kept in a variable:

my $word = "cool";
my $option = "-i";
my $file = "/usr/share/dict/words";
my $output = qqx{grep $option $word $file};
# runs the command: grep -i cool /usr/share/dict/words 
say $output;      # OUTPUT: «Cooley␤Cooley's␤Coolidge␤Coolidge's␤cool␤...»

See also run and Proc::Async for better ways to execute external commands.