Re: How do I send a wild card to "run"?
[email protected] (ToddAndMargo via perl6-users) Sun, 2 Nov 2025 16:09:40 -0800
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <[email protected]> |
On 11/2/25 2:53 PM, ToddAndMargo via perl6-users wrote:
> Hi All,
>
>
> I am trying to list all *.raku programs with
> the "run" command (I am updating my "run"
> keeper with examples):
>
> <RunTest.raku>
> #!/usr/bin/raku
>
> # my @args = "ls", "-al", Q[RunTest.raku];
> my @args = "ls", "-al", Q[*.raku];
> my $p = run( |@args, :err, :out );
>
> my int $x = $p.exitcode;
> my Str $y = $p.err.slurp(:close);
> my Str $z = $p.out.slurp(:close);
>
> say "\@args = <" ~ @args ~ ">";
> print "\$z = <$z>\n";
> </RunTest.raku>
>
>
> result:
> @args = <ls -al *.raku>
> $z = <>
>
> The commented out @args line does work.
>
> How do I send a wild card to "run"?
>
> Yours in Confusion,
> -T
According to search.brave.com's AI, I can't send
wild card to "run". I have to use "shell":
https://search.brave.com/search?q=raku+how+do+I+send+a+wild+card+to+the+run+command%3F&source=web&summary=1&conversation=8e3cc3e5b7db6af91fef72
To send a wildcard to the run command in Raku, you need to
use the shell function instead of run, as run does not
perform shell expansion of wildcards like * or ?. The
shell function invokes the system shell, which handles
wildcard expansion.
I can always filter with starts-with, contains, ends-with.
Is there a trick to get somethings equivalent to a wild
card into "run"?