V
V
Viktor Taran2018-10-26 20:50:02
bash
Viktor Taran, 2018-10-26 20:50:02

How to fetch php variables in using bash?

You need a beautiful solution to pull out the database variables for the dump.
there is a solution in php, do not offer. I want beautiful on bash.
quickly figured out the option

grep "DBLogin =" bconn.php | grep -Eo "\".+\"" | tr -d \"

Correct conclusion
3dpaneli
But it obviously does not smell elegant, and in addition it can meet both "" and ''
Who has any ideas how best to do it?
dbcon.php
<?
define("DBPersistent", false);
$DBType = "mysql";
$DBHost = "localhost";
$DBLogin = "3dpaneli";
$DBPassword = "fUdXpwHsW#9";
$DBName = "3dpaneli";
$DBDebug = false;
$DBDebugToFile = false;
@set_time_limit(60);
define("DELAY_DB_CONNECT", true);
define("CACHED_b_file", 3600);
define("CACHED_b_file_bucket_size", 10);
define("CACHED_b_lang", 3600);
define("CACHED_b_option", 3600);
define("CACHED_b_lang_domain", 3600);
define("CACHED_b_site_template", 3600);
define("CACHED_b_event", 3600);
define("CACHED_b_agent", 3660);
define("CACHED_menu", 3600);
define("BX_UTF", true);
define("BX_FILE_PERMISSIONS", 0644);
define("BX_DIR_PERMISSIONS", 0755);
@umask(~BX_DIR_PERMISSIONS);
@ini_set("memory_limit", "512M");
define("

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xotkot, 2018-10-27
@shambler81

awk -F'[",'"'"']' '/DBLogin =/ {print $2}' bconn.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question