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.