Todd C. Miller <[email protected]> wrote:

> On Mon, 15 Nov 2021 20:13:01 +0300, [email protected] wrote:
> 
> > [/opt/bin]$ cat check.sh
> > #!/bin/sh
> >
> > _ret=$(ps aux | grep sleeploop.sh | grep -v grep | awk '{print $2}')
> > test -z ${_ret} && /opt/bin/sleeploop.sh &
> 
> By default, ps uses 80 columns so the information is probably being
> cut off.  I'm guessing your interactive terminal is wider than 80
> columns.  You can add 'w' a few times to your ps options to extend
> the width but you are much better off using pgrep for this.

pgrep is better.  But there are so many risks in this construct I would not
trust it at all.

Reply via email to