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 8: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 8:55
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.