Fortsetzung
bearbeitet von Raketenwilli> Wobei das escapeshellarg() im konkreten, speziellen Fall als „notlos“ erscheint.
(Fortsetzung)
Aber **für sqlite** sähe das anders aus, denn das schreibt in seinem Dialekt die Verwendung von einfachen Quotas (also nicht Backticks) für alle Arten von Namen vor:
~~~PHP
$backup_db = 'db0815';
$backupoption = ' | grep -vP '
. escapeshellarg(
'^USE \''
. $backup_db
. '\';$'
)
;
~~~
Resultat:
~~~
| grep -vP '^USE '\''db0815'\'';$'
~~~
Test:
~~~BASH
echo -e "USE 'db0815';\nSonstwas" | grep -vP '^USE '\''db0815'\'';$'
~~~
Resultat:
~~~
Sonstwas
~~~
**🆗**
(Fortsetzung)
Aber **für sqlite** sähe das anders aus, denn das schreibt in seinem Dialekt die Verwendung von einfachen Quotas (also nicht Backticks) für alle Arten von Namen vor:
~~~PHP
$backup_db = 'db0815';
$backupoption = ' | grep -vP '
. escapeshellarg(
'^USE \''
. $backup_db
. '\';$'
)
;
~~~
Resultat:
~~~
| grep -vP '^USE '\''db0815'\'';$'
~~~
Test:
~~~BASH
echo -e "USE 'db0815';\nSonstwas" | grep -vP '^USE '\''db0815'\'';$'
~~~
Resultat:
~~~
Sonstwas
~~~
**🆗**
Fortsetzung
bearbeitet von Raketenwilli> Wobei das escapeshellarg() im konkreten, speziellen Fall als „notlos“ erscheint.
(Fortsetzung)
Aber **für sqlite** sähe das anders aus:
~~~PHP
$backup_db = 'db0815';
$backupoption = ' | grep -vP '
. escapeshellarg(
'^USE \''
. $backup_db
. '\';$'
)
;
~~~
Resultat:
~~~
| grep -vP '^USE '\''db0815'\'';$'
~~~
Test:
~~~BASH
echo -e "USE 'db0815';\nSonstwas" | grep -vP '^USE '\''db0815'\'';$'
~~~
Resultat:
~~~
Sonstwas
~~~
**🆗**