in reply to Re: run in-program shell script under windows using cygwin
in thread run in-program shell script under windows using cygwin

I was also surprised ...

Why?

$ perl -V:sh sh='cmd /x /c';

Unless your cygwin perl hash something bash in there, cmd.exe is your shell

My *cygwin*alike* has

$ C:\citrusperl\mingw\msys\bin\perl -V:sh sh='/bin/sh';

So even if *my*cygwin*alike* has got /bin/sh , it won't work when calling perl from cmd.exe, only from the bash itself ... in actual cygwin that might get resolved (if cygwin perl is linked to cygwin dll) but it depends on the perl being called

Replies are listed 'Best First'.
Re^3: run in-program shell script under windows using cygwin
by Anonymous Monk on Jul 30, 2014 at 19:02 UTC

    So even if *my*cygwin*alike* has got /bin/sh , it won't work when calling perl from cmd.exe

    Actually it will, same magic that actual cygwin uses to resolve it is used by the mingw/msys compiled version

    So check your paths, check your shebangs people :)

Re^3: run in-program shell script under windows using cygwin
by Laurent_R (Canon) on Jul 30, 2014 at 19:05 UTC
    I was surprised because I did not expect that, simply.

    Now, running your command, I get this:

    $ perl -V:sh sh='/bin/sh';
    And I have also this:
    $ which sh /usr/bin/sh
    Well, there is something that I don't get here...

      Well, there is something that I don't get here...

      Well, does /bin/sh exist? Don't know why your perl is configured with /bin/sh instead of /usr/bin/sh ... :)

        Well, /bin/sh and /usr/bin/sh both exist, and the script works (with Perl) with both paths in the shebang line of the shell script.
Re^3: run in-program shell script under windows using cygwin
by sandy105 (Scribe) on Jul 31, 2014 at 08:07 UTC

    when i run the above i get

    $ which sh /usr/bin/sh

    and

    $ perl -V:sh sh='cmd /x /c';
      Well, you're running a windows perl under cygwin , cygwin isn't windows , cmd.exe don't do shell scripts without ftype/assoc