in reply to Re^2: processing PSQL with system command
in thread processing PSQL with system command

On this system we are not permitted to install any modules

Well then you will be stuck in quote-escaping hell as I see now you have a nasty mix of both double and single quotes there. This test looks OK:

use strict; use warnings; use Test::More tests => 1; my $want = q{su - admin -c "psql -p 5555 mcdb -c \\"update ev_cus_prof + set active='f' where epid='INIT_EV_HIGH_PRIORITY';\\""}; my $PSQL = q{psql -p 5555 mcdb -c \"update ev_cus_prof set active='f' +where epid='INIT_EV_HIGH_PRIORITY';\"}; my $cmd = qq{su - admin -c "$PSQL"}; is $cmd, $want, "have $want";

But, in your shoes I would approach whichever entity has imposed the no-modules rule and point out that it means you have to ask the help of complete strangers on the internet to solve what would otherwise be a trivial task.


🦛

Replies are listed 'Best First'.
Re^4: processing PSQL with system command
by g_speran (Scribe) on Mar 30, 2022 at 15:47 UTC
    Thank you Kindly!!!

    The following worked
    my $PSQL = q{psql -p 5555 mcdb -c \"update ev_cus_prof set act +ive='f' where epid='INIT_EV_HIGH_PRIORITY';\"}; system(qq{su - admin -c "$PSQL"});