Bash Command in PHP

07/21/2022 12:23 MaLLaH95#1
Hallo,

ich habe eine Frage bezüglich eines Bash Scriptes, ich will diesen in PHP ausführen aber PHP zeigt fehler an und ich glaube es liegt an den ` zeichen

Quote:
$test = " echo "the middle is `echo $a | du -sh -s -m /home/nvme/user1/SERVER_6 | awk '{ print $1}'`" ";
[Only registered and activated users can see links. Click Here To Register...]
07/21/2022 19:06 False#2
Du musst die zusätzliche Anführungszeichen escapen.
PHP Code:
$test "echo \"the middle is `echo $a | du -sh -s -m /home/nvme/user1/SERVER_6 | awk '{ print $1}'`\""
07/30/2022 23:18 .Shōgun#3
Code:
$test = ' echo "the middle is `echo $a | du -sh -s -m /home/nvme/user1/SERVER_6 | awk '"'"'{ print $1}'"'"'`" ';
{} are special characters when used inside double quotes, and they cannot be escaped
07/30/2022 23:40 False#4
Quote:
Originally Posted by .Shōgun View Post
Code:
$test = ' echo "the middle is `echo $a | du -sh -s -m /home/nvme/user1/SERVER_6 | awk '"'"'{ print $1}'"'"'`" ';
{} are special characters when used inside double quotes, and they cannot be escaped
Nobody talked about the {} chars, in this context you don't event have to escape them..
[Only registered and activated users can see links. Click Here To Register...]