0

I tried this answer to simulate a watch without clear:

while sleep 1; do ps -ef | grep convert | grep -v grep done

It leaves me with a greater-than symbol and the cursor next to it, nothing happens. Variants I tried that don’t work either:

while sleep 1; do ps -ef \| grep convert \| grep -v grep done
while sleep 1; do 'ps -ef | grep convert | grep -v grep' done

Why I want to do this: I want the results to be printed to standard output one below the next, and I do not want the line to be truncated to the window size.

  • The ; before the done is missing, so the command is not finished and you get the > prompt – Philippos Aug 15 '17 at 08:50
  • 1
    Btw, a trick to avoid that double filtering of ps is to use a superfluous regular expression like grep conver[t]: This will match your desired line, but not the grep line itself! – Philippos Aug 15 '17 at 08:55

1 Answers1

1

You're missing a semicolon. The correct command is:

while sleep 1; do ps -ef | grep convert | grep -v grep; done

On a multi-line command, this would be

while sleep 1
do 
   ps -ef | grep convert | grep -v grep
done
dr_
  • 29,602