Re: How do I send a wild card to "run"?

2025-11-02 Thread ToddAndMargo via perl6-users

On 11/2/25 8:00 PM, Sean McAfee wrote:
On Mon, Nov 3, 2025 at 6:53 AM ToddAndMargo via perl6-users [email protected] > wrote:


How do I send a wild card to "run"?


You don't.  You have to do yourself what the shell does when it sees a 
wildcard, and generate the list of filenames yourself, as in the 
following examples:


my $p = run , dir.grep(/'.raku' $/);
my $p = run , dir(test => /'.raku' $/);
my $p = run , dir(test => *.ends-with('.raku'));



Thank you!


Re: How do I send a wild card to "run"?

2025-11-02 Thread Sean McAfee
On Mon, Nov 3, 2025 at 6:53 AM ToddAndMargo via perl6-users <
[email protected]> wrote:

> How do I send a wild card to "run"?
>

You don't.  You have to do yourself what the shell does when it sees a
wildcard, and generate the list of filenames yourself, as in the following
examples:

my $p = run , dir.grep(/'.raku' $/);
my $p = run , dir(test => /'.raku' $/);
my $p = run , dir(test => *.ends-with('.raku'));


Re: How do I send a wild card to "run"?

2025-11-02 Thread ToddAndMargo via perl6-users

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):


#!/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";



result:
     @args = 
     $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"?