On Sun, Jun 3, 2018 at 6:06 PM ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote:

    On 06/03/2018 02:54 PM, Brad Gilbert wrote:
     > You can use q[./] instead of \'./\'
     > (especially useful so that it will work on both Windows and Unix
     >
     > But in this case it is even better to use -I and -M
     >
     >      p6 -I. -MRunNoShell -e '( my $a, my $b ) =
     >           RunNoShell::RunNoShell("ls *.pm6"); say $a;'
     >
     > On Sun, Jun 3, 2018 at 4:47 PM, ToddAndMargo
    <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote:
     >>>> On Sun, Jun 3, 2018 at 5:28 PM ToddAndMargo
    <toddandma...@zoho.com <mailto:toddandma...@zoho.com>
     >>>> <mailto:toddandma...@zoho.com <mailto:toddandma...@zoho.com>>>
    wrote:
     >>>>
     >>>>      Hi All,
     >>>>
     >>>>      What am I doing wrong here?
     >>>>
     >>>>
     >>>>             $ p6 'lib \'./\'; use RunNoShell; ( my $a, my $b ) =
     >>>>      RunNoShell::RunNoShell("ls *.pm6"); say $a;'
     >>>>
     >>>>             bash: syntax error near unexpected token `='
     >>>>
     >>>>      Huh ???
     >>>>
     >>>>
     >>>>      This is RunNoShell.pm6
     >>>>
     >>>>            sub RunNoShell ( $RunString ) is export {
     >>>>               ...
     >>>>               return ( $ReturnStr, $RtnCode );
     >>>>            }
     >>>>
     >>>>      Many thanks,
     >>>>      -T
     >>
     >>
     >> On 06/03/2018 02:36 PM, Brandon Allbery wrote:
     >>>
     >>> bash doesn't like nested single quotes, even with escapes. So
    the first \'
     >>> gave you a literal backslash and ended the quoted part, then
    the second \'
     >>> gave you a literal ' and continued without quoting. The final '
    would then
     >>> open a new quoted string, but bash doesn't get that far because
    it sees the
     >>> (now unquoted) parentheses and tries to parse them as a command
    expansion.
     >>>
     >>> allbery@pyanfar ~/Downloads $ echo 'x\'y\'z'
     >>>   > ^C
     >>>
     >>> Note that it thinks it's still in a quoted string and wants me to
     >>> continue.
     >>>
     >>
     >> p6 does not like `lib ./`,  meaning use the current directory
     >> without the single quotes.  Any work around?

    It needs the path, which is ./

    $ perl6 -I -MRunNoShell '( my $a, my $b ) = RunNoShell::RunNoShell("ls
    \*.pm6"); say $a;'

    Could not open ( my $a, my $b ) = RunNoShell::RunNoShell("ls \*.pm6");
    say $a;. Failed to stat file: no such file or directory

On 06/03/2018 03:09 PM, Brandon Allbery wrote:
No, the path is just '.'. The trailing '/' does nothing. (Actually, it will be handled as './.' which is also the same as just '.'.)

Trailing slash somehow being required for directories is a bit of shell cargo culting.


So how would I put the path into `-I. -M`?

Reply via email to