Shell Script segmentation error

Hi I have a shell script that should be run based on the return of php code:

x=1
while [[ "$x" != 5 ]] 
do
  echo "Welcome $x"
  php test.php
  x=$?
done

And php code

echo "Testdfdf test".PHP_EOL;
exit(4);

So I want when I get 5 from php to exit the loop.

But sometimes I get:

./myshell: line 7: 20529 Segmentation fault      php test.php

Should it work without problems?

+3
source share
3 answers

Probably due to this bug that affects both Ubuntu and Debian ... https://bugs.launchpad.net/ubuntu/+source/php5/+bug/343870

+2
source

He should do this, but doesn't know why php ends with segfault.

+1
source

while , php script 4 , while != 5. , . ? , php ( ), .

+1

Source: https://habr.com/ru/post/1713438/


All Articles