Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: execute shell script from perl

by choroba (Cardinal)
on Sep 28, 2017 at 19:13 UTC ( [id://1200308]=note: print w/replies, xml ) Need Help??


in reply to execute shell script from perl

qx , as documented in perlop, runs /bin/sh, which might be different to your terminal shell. Most probably, the shell in which the "Here String" works is bash, but /bin/sh is dash which doesn't support it.

Also note that what follows <<< isn't a "string argument", but it gets passed to the preceding command on standard input (after some expansions).

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: execute shell script from perl
by Mr. Muskrat (Canon) on Sep 29, 2017 at 15:53 UTC

    /bin/sh is dash

    That all depends on the OS. That appears to be true for Debian and Debian-based OSes (Ubuntu, ArchLinux, etc). On Fedora 25 /bin/sh is a symbolic link to bash. On some OSes /bin/sh is still the Bourne shell.

      On some OSes /bin/sh is still the Bourne shell.

      And that's not all. /bin/sh varies wildly with OS and OS version, so it should be avoided where possible. If one has to resort to using a shell (why on earth?), one should explicitly use that shell (e.g. use /bin/bash, /bin/ksh or the like) instead of hoping for the default shell.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-28 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found