(double backslash in front of parens:) #!/usr/bin/perl $pat='+\\([^-]\\)-+\\([^-]\\).rpm'; $a=`bash -c 'shopt -s extglob ;echo gcc-$pat'`; print "a=$a\n";