[Tips]Why command “sleep 1m” doesn’t work in mac
Problem
In my shell script, “sleep 1m” command doesn’t wait 1 minutes but 1 second.
sleep.sh
#!/bin/sh echo "start timer" sleep 1m echo "stop"
Environment
macOS Catalina 10.15.5
The cause of this problem
In Mac OS X, sleep command doesn’t work with quantifiers and takes argument num just as num seconds.
Reference: OSX bash “sleep”, Mac OS X Man Pages
Solution
Use 60 times minutes.
sleep.sh
#!/bin/sh echo "start timer" sleep 1*60 echo "stop"