Lawrence D'Oliveiro wrote:
> The following Bash function returns the number of seconds from now until the
> specified time:
>
> till() { echo $(($(date -d "$1" +%s) - $(date +%s))); }
>
> For example, how long is it until 6 o’clock:
>
> ldo@theon:~> till 06:00
> 20932
>
> What’s the value of this? You can delay until a particular time before
> performing an action, e.g.
>
> sleep $(till 07:30); echo 'Wakey! Wakey!'
>
Why not just use 'at'? Otherwise you have your bash script hanging
around until 7:30, doing nothing.
Cheers,
Cliff
--
The ends justifies the means - Niccolò di Bernardo dei Machiavelli.
The end excuses any evil - Sophocles
|