bash - Escape variable in Jenkins shell execution -
we use jenkins run wordpress cli stuff us, , pass in php wordpress cli. example:
cd wordpress && wp core config --skip-check --dbhost=dbhost --dbname=dbname --dbuser=user --dbpass=pass --extra-php <<php define('host', $_server['http_host']); php
jenkins interprets $_server
, i'm left ['http_host']
. how can escape $_server
?
i've tried doing define('host', \$_server['http_host']);
, still gets interpreted variable.
figured out... wrap first section of defining heredoc in double quotes.
cd wordpress && wp core config --skip-check --dbhost=dbhost --dbname=dbname --dbuser=user --dbpass=pass --extra-php <<"php" define('host', $_server['http_host']); php
it no longer interprets $_server
.
Comments
Post a Comment