On Wed, Dec 24, 2014 at 02:09:08AM EST, Philippe Meunier wrote:
> Hello,
Hi Philippe,
> I have a small ksh script that uses ps(1) inside a background loop to
> monitor some process while the script does some other stuff in the
> foreground. Here is a simplified version of the script that monitors
> the startx process, as an example:
>
> #!/bin/ksh -ex
> while true; do ps -lww | egrep startx | egrep --line-buffered -v egrep; sleep
> 1; done &
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
As you already got the answer you were looking for, I'll only add my 2p,
albeit slightly off-topic.
Obviously, I don't know what your exact reasons are to use the above
construct but three processes seems a bit excessive since pgrep(1) can
be used.
Regards,
Raf