在bash脚本中包含PHP命令执行它并退出

I have the folowing script.

#!/usr/bin/env bash

target="anotherfolder";
dest="somefolder";

find $dest -maxdepth 1 -type f | sort -r | while IFS= read -r file; do

    while /bin/true; do
        files=$(ls -a "$dest" | grep -Fxv "$ignore")
        if [ "$files" ];
        then
            php "$files" | nc 10.x.x.x 9100
            mv "$files" "$dest"
            break
        fi
    done
done

When i run the script is working only with the first file, after that is stop. I assume i have to add an exit code after

  php "$files" | nc 10.x.x.x 9100

Can you help ?

Barmar is correct. It is also not so clear why you are using find command here. You just need only one loop, use below script it might fix your problem. Also always provide the details, exactly what you are trying to do with your script i.e. your requirement that help us to provide a correct answer.

 #!/usr/bin/env bash

target="anotherfolder";
dest="somefolder";

#find $dest -maxdepth 1 -type f | sort -r | while IFS= read -r file; do

#while /bin/true; do
 files=$(ls -a "$dest" | grep -Fxv "$ignore")
 for file in files
 do 
    if [ "$file" ];
    then
        php "$file" | nc 10.x.x.x 9100
        mv "$file" "$target"
        #in above you need to move it to another directory
        break
    fi
  done
#done