note 114870 deleted from function.shell-exec by cmb
| From: | cmb@php.net | Date: | Sun, 14 Jul 2019 11:33:56 +0000 |
| Subject: | note 114870 deleted from function.shell-exec by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211588@lists.php.net to get a copy of this message | ||
Note Submitter: xxxpaul1104xxx at gmail dot com
----
//wish this could help for handle the shell_exec() output strings where "\n" that looks
like a " " space.
//ex:
$configPath = "/home/somewhere";
$configList = shell_exec("ls $configPath/123.*.cfg"); // output is
"/home/somewhere/123.111.cfg /home/somewhere/123.112.cfg"
// there looks like a "space" between output strings, but that's a "\n"
actually.
$nodeList =
trim(str_replace("\n",",",str_replace("$configPath/","",str_replace(".cfg","",$configList))));
// get "123.111,123.112"