in reply to Shell Commands executed in perl script

For some obscure reason, Shell.pm quotes apostrophes (') and backslashes (\) on UNIX, and spaces and quotes (") on Windows. If you set $Shell::raw to true no quoting whatsoever is done, so the only remaining thing to do is to negate the special meaning of characters ',{,},$ inside the awk statement. To be consistent here is an example of what you have to do:
use strict; use Shell; my $sh = Shell->new; $Shell::raw='TRUE'; print $sh->ps("aux | grep firefox | awk \'\{print \$2\}\'");

Replies are listed 'Best First'.
Re^2: Shell Commands executed in perl script
by Anonymous Monk on Apr 29, 2008 at 18:42 UTC
    Man... you saved me: $sh = Shell->new; $Shell::raw='TRUE'; my $EXISTS_= $sh->java("-classpath bpjt-v2.1-3.jar:pmpclient.jar com.mycompany.clients.FilterWithAttributes $CNUM_ID manager"); my $CNUM_MNGR = $sh->echo("\"$EXISTS_\" | grep mng: | gawk -F \",\" \'\{ print \$1 \}\' | gawk -F \"=\" \'\{ print \$2 \}\'"); Thanks, a lot!