bash: 4.3.42(1)-release (x86_64-pc-linux-gnu)
Executing the following script:
# This is myscript.sh
line=$(ps aux | grep [m]yscript)  # A => returns two duplicates processes (why?)
echo "'$line'"
ps aux | grep [m]yscript          # B => returns only one
Output:
'tom   31836  0.0  0.0  17656  3132 pts/25   S+   10:33   0:00 bash myscript.sh
tom   31837  0.0  0.0  17660  1736 pts/25   S+   10:33   0:00 bash myscript.sh'
tom   31836  0.0  0.0  17660  3428 pts/25   S+   10:33   0:00 bash myscript.sh
Why does the inline executed ps-snippet (A) return two lines?
 
     
     
    