I use PHP exec() to start a process in Bash that has $$ in its commandline. When using PHP though, PHP itself seems to take the variable $$ instead of letting Bash use it in the script.
Does PHP use this variable? Assuming so, how do I preserve it for the Bash script?
Example: exec('echo $$') performs echo 1538 in Bash, not echo $$, since PHP seems to have taken the variable $$.
Php would not ‘take’ the
$$value, since it’s inside a single-quoted string.It’s bash converting it to the PID of the bash process handling your echo command.
If you want to literally output two
$via the echo command, you’ll have to escape them:followup:
followup 2: