bronto has asked for the wisdom of the Perl Monks concerning the following question:

Dearest monks and nuns.

Recently I have been bitten by an unexpected behaviour of a commercial software. In short, if I started a daemon with qx in a perl script, it failed to work properly.

I am still investigating. Anyway, it seems that the daemon fails to work properly if it doesn't run under a "classic" Bourne shell, while qx runs it inside a Bash shell.

The following script:

#!/usr/bin/perl use strict ; use warnings ; my $output = qx'echo $SHELL' ; print $output ;



The man page for qx says:

qx/STRING/ ‘STRING‘ A string which is (possibly) interpolated and then exe- cuted as a system command with "/bin/sh" or its equiva- lent.[...]

This leads me to the question: how does qx select the aforementioned "/bin/sh equivalent"?


In theory, there is no difference between theory and practice. In practice, there is.