Reputation: 951
Hi I have a shell script which should run based on the return of php code:
x=1
while [[ "$x" != 5 ]]
do
echo "Welcome $x"
php test.php
x=$?
done
And the php code
echo "Testdfdf test".PHP_EOL;
exit(4);
So I want whenever I get 5 from php to quit the loop.
But I get sometimes:
./myshell: line 7: 20529 Segmentation fault php test.php
Should it loop without problem?
Upvotes: 3
Views: 2492
Reputation: 911
Probably because of this error which affects both Ubuntu and Debian... https://bugs.launchpad.net/ubuntu/+source/php5/+bug/343870
Upvotes: 2
Reputation: 342363
your shell while loop will loop forever, as your php script returns 4 to shell, and your while loop checks for !=5. which means the condition is not going to be met. what actually is it you are wanting to do? unless necessary, i would advise to do everything with php (or shell) , but try not to intermingle both.
Upvotes: 1
Reputation: 1497
It should and it does, but no clue about why php is ending with a segfault.
Upvotes: 1