linux - Why I'm getting "sh" calling "echo $0" inside bash inside php exec? -


मेरे पास ऐसा कोड है:

  सार्वजनिक फ़ंक्शन शेल ($ कोड) {$ code = Preg_replace ('/ "/', '\\' ', $ कोड); Exec ('bash -c' '$ code।' '', $ परिणाम); वापसी का परिणाम; }  

और जब मैं shell ("echo $ 0") कॉल करता हूं; मैं bash के बजाय sh हो रहा हूं, क्यों?

मूल शेल डबलक्वॉट्स के भीतर चर का विस्तार कर रहा है। चर विस्तार को रोकने के लिए, एकल उद्धरणों का उपयोग करें:

  exec ("bash -c '" $ code। "" ", $ Result);  

Comments

Popular posts from this blog

python - rpy2 import is not working -

javascript - How to get MySQL query result returned using $.ajax -

javascript - How to use the code plugin with popcornjs -