Timeout command on Mac OS X?

后端 未结 5 1965
长发绾君心
长发绾君心 2020-12-13 05:29

Is there an alternative for the timeout command on Mac OSx. The basic requirement is I am able to run a command for a specified amount of time.

e.g:

         


        
5条回答
  •  春和景丽
    2020-12-13 06:02

    You can limit execution time of any program using this command:

    ping -t 10 google.com & sleep 5; kill $!
    

提交回复
热议问题