root# cat test.sh
#!/bin/bash
IFS="
"
PS_OUT=(`ps -eo pid,etime,cmd | grep -v grep | grep test`)
for i in ${PS_OUT[@]}
do
echo "LINE: $i"
done
root# ./test.sh
LINE: 6533 00:00 /bin/bash ./test.sh
LINE: 6534 00:00 /bin/bash ./test.sh
Почему два процесса в списке?