Bash sleep in milliseconds

后端 未结 3 1629
别那么骄傲
别那么骄傲 2020-12-15 03:07

I need a timer which will work with milliseconds. I tried to use sleep 0.1 command in a script, but I see this error message:

syntax error: invali

3条回答
  •  被撕碎了的回忆
    2020-12-15 04:06

    Make sure you're running your script in Bash, not /bin/sh. For example:

    #!/usr/bin/env bash
    sleep 0.1
    

    In other words, try to specify the shell explicitly. Then run either by: ./foo.sh or bash foo.sh.

    In case, sleep is an alias or a function, try replacing sleep with \sleep.

提交回复
热议问题