Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: run in-program shell script under windows using cygwin

by AppleFritter (Vicar)
on Jul 30, 2014 at 20:26 UTC ( [id://1095662]=note: print w/replies, xml ) Need Help??


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

I've also got Strawberry Perl installed on this box, but no other perls beyond these two. So far, they've never had any conflicts, as far as I was able to tell; invoking perl from a Cygwin shell always gives me Cygwin's perl, invoking it from a DOS command line alwasy gives me Strawberry.

I've got a slightly different Perl version, though:

$ perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for cygwin-th +read-multi-64int (with 7 registered patches, see perl -V for more detail) Copyright 1987-2011, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. $

As far as I can tell, this is because I'm using a 32-bit Cygwin (corroborated by the fact that the Cygwin installer is also offering me 5.10.1 and 5.18.2), rather than a 64-bit one. I don't know if this should make a difference, but I couldn't help but notice.

Replies are listed 'Best First'.
Re^5: run in-program shell script under windows using cygwin
by Laurent_R (Canon) on Jul 30, 2014 at 21:51 UTC
    It suddenly occurred to me that I did a very stupid mistake in my test (although I perfectly knew this had to be part of my test, I just forgot to do it when I ran the test).

    I forgot to change the shell script privileges. So, after realizing this error, I changed the hello.sh script to 755, and I now get the expected output:

    $ perl -e '$command = "./hello.sh"; $out = `$command`; print $out, "\n +";' hello world!
    So, it does work. My error was really silly, because my very first reaction when I read the OP was that, probably, either the shebang line was missing or not correct in the shell script, or the shell script file permissions were not set correctly. And then, I made the test with only one of the two things fixed, not the other. Sorry about that. But, on the other hand, the good news is that it might very well explain the OP's original problem and give her/him a way to solve it.

    To the OP: files permissions may or may not be the source of the problem, try to chmod your shell script to execute rights (755 might be a good parameter), and try again.

      Good catch! I hadn't considered that, but it makes perfect sense. I'll have to file this away in my mind and remember it for the future.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1095662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-23 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found