4 Comments

  1. CM

    This may help someone new to shell scripting if you find yourself on a system without watch:

    ## while true; do ; sleep ; done

    will work as a minimal implementation, work with pipes, etc. As an example like the post above:

    ## while true; do clear; sensors | grep temp | awk '{ print $2 }'; sleep 1; done

    Any number of commands can be stacked with semi-colons separating them.

    Reply

  2. You coule also use tail -F file...
    Auto refresh and display even when the file change.

    Reply

    • You are exactly correct. I was struggling to come up with a good example when I wrote this, so I used the tail example. tail -F is certainly more appropriate for that particular task.

      Thanks for your comment.

      Reply

  3. Completely agree. `watch` proved to be one great tool that I personally find it extremely helpful. It is also cool when you add the '-d' argument, it highlight the differences between successive updates so you can actually easily notice when something has changed.

    for example:

    ## watch -d -n1 "sensors | grep temp | awk '{ print $2 }'"

    cheers

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *