Add Bash tempos precis snippet

This commit is contained in:
chteufleur 2015-08-18 16:08:39 +02:00
parent 839f2fd6a7
commit 504576a887
1 changed files with 15 additions and 0 deletions

15
Bash/temposPrecis.sh Normal file
View File

@ -0,0 +1,15 @@
#/!bin/bash
let "interval=30"
start=$(date +"%s")
# do something
end=$(date +"%s")
let "timeTaken=end-start"
let "timeToSleep=interval-timeTaken"
if [ $timeToSleep -gt 0 ]
then
echo "sleep for $timeToSleep sec"
sleep $timeToSleep
fi