how to us esleep command code example
Example 1: sleep command bash
sleep NUMBER[SUFFIX] #Just use this command structure to wait/sleep
#Example:
sleep 5m #sleeps 5 minutes
sleep 0.1 #sleeps 0.1 seconds or 100 miliseconds
#Suffixes
s - seconds (default)
m - minutes
h - hours
d - days
When no suffix is specified, it defaults to seconds.
Example 2: linux sleep with exec /bin/sleep
int pid= fork();
if (pid==0) { // child
execl("/bin/sleep", "sleep", argv[1], NULL); // argv[1] is the sleeptime
perror("execl");
return EXIT_FAILURE;
}
if (waitpid(pid,NULL,0)<0) {
perror("waitpid");
return EXIT_FAILURE;
}