In Quoting constructs§
See primary documentation in context for Shell quoting: qx
To run a string as an external program, not only is it possible to pass the string to the shell
or run
functions but one can also perform shell quoting. There are some subtleties to consider, however. qx
quotes don't interpolate variables. Thus
my = "there";say
prints simply hello
. Nevertheless, if you have declared an environment variable before calling raku
, this will be available within qx
, for instance
WORLD="there" raku> say
will now print hello there
.
The result of calling qx
is returned, so this information can be assigned to a variable for later use:
my = ;say ; # OUTPUT: «hello!»
See also shell, run and Proc::Async
for other ways to execute external commands.