> On 2021-02-05, at 02:45, Walter Dnes <[email protected]> wrote:
> 
> done < /dev/shm/temp.txt

You don't need to write a temporary file. You can pipe this directly into the 
while loop:

while read
do
...
done < <(ps -ef | grep ${1} | grep -v "grep ${1}" | grep -v pstop)

Also to avoid the second grep in Bash at least:

grep "[${1:0:1}]${1:1}"

 $ ps -ef | grep '[l]vmetad'
root         965       1  0 Jan31 ?        00:00:00 /sbin/lvmetad -f

^ No grep in output.

--
Andrew

Reply via email to