I wrote this bash:
#!/bin/bash
eval "(a command) &"
pid1=$!
eval "(while kill -0 $pid1; do .... ; done) &" #It creates file.txt after few seconds
pid2=$!
if [ -s /tmp/file.txt ]; then
for line in $(cat /tmp/file.txt)
do
sth
done
With logic of bash scripting: Is the values of pid1 and pid2 correct?
Is this script running correctly?