in reply to Re^2: system call (backticks) with pipes
in thread system call (backticks) with pipes
I want variable substitution in part of the command.
So just escape those dollars which you want to pass as literals.
#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 1; my $boot_device = '/dev/md126p1'; my $cmd = qq#blkid $boot_device | awk '{ print \$2 }' | sed 's/"//g'#; my $shouldbe = q#blkid /dev/md126p1 | awk '{ print $2 }' | sed 's/"//g +'#; is ($cmd, $shouldbe);
And never pipe awk to sed - that would be pointless.
|
|---|