ps -ef | while read line; do for i in $line; do if [ $i = 'bash' ]; then echo $line; fi; done; done; unset i;
The command runs properly displaying the Bash processes but an additional Bash process is being created and displayed. I'm hoping it has something to do inside the
if checking. I tried to run it with/without single/double quotes both for
bash inside the
if condition. The process is still being created and shown. I could have used
grep to get the output but wanted to try it this way.
Pls correct me.