I want to list a process with its infos through ps in shell. Here is my script:
#!/bin/sh
for line in `ps aux| grep test.py`
do
    echo $line
done
But output is:
hey
13241
0.0
0.3
48388
13528
pts/18
S+
18:50
0:00
python
test.py
hey
13370
0.0
0.0
14504
1016
pts/21
S+
19:00
0:00
grep
test.py
It divide the line into many parts, but I want I can get one line information about the process which name is test.py like command in terminal:
hey   13241  0.0  0.3  48388 13528 pts/18   S+   18:50   0:00 python test.py
hey   13446  0.0  0.0  14504   976 pts/21   S+   19:08   0:00 grep --color=auto test.py
how to solve that
 
     
     
    