Search code examples
androidandroid-studioadb

ADB shell command to execute repeatedly every x interval


Wish to ask if there is any ADB command feature to execute same command repeatedly after a mentioned interval. like watch command for linux

eg

  ls -l to execute repeatedly after every 20 second.

Solution

  • You can use an unconditional loop:

    while true; do ls -l; sleep 20; done
    

    You can also look into tools like inotifywait or fsmon depending on what you are trying to accomplish. You can also install busybox for Android which contains the watch command.