In Quoting constructs§
See primary documentation in context for Shell quoting with interpolation: 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 = "there";say ; # OUTPUT: «hello thereâ€Â»
Again, the output of the external command can be kept in a variable:
my = "cool";my = "-i";my = "/usr/share/dict/words";my = ;# runs the command: grep -i cool /usr/share/dict/wordssay ; # OUTPUT: «Cooleyâ€Cooley'sâ€Coolidgeâ€Coolidge'sâ€coolâ€...»
Be aware of the content of the Raku variable used within an external command; malicious content can be used to execute arbitrary code. See qqx
traps
See also run and Proc::Async
for better ways to execute external commands.