[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Command-line-interface (CLI) calculator to work out the difference between 2 dates



Ron Johnson <ron.l.johnson@cox.net>:
>  On 08/24/08 11:32, Rick Pasotto wrote:
> > 
> > Why pipe it to bc? Keep it in the shell:
> > 
> > $ echo $[$[$(date -d 20090824 +%s) - $(date -d 20080724 +%s)] / 86400]
> > 396
> 
>  [snip]
>
>  One stylistic reason for piping to bc is that some people think that 
>  bash's $[] syntax gets too hard to read if you nest it too much.

I've been running *nix on my home boxes since '93, and I've never even
seen that syntax.  That's a bashism, I hope?

I do own, and have studied, O'Really's Learning the bash shell.


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)    http://blinkynet.net/comp/uip5.html      Linux Counter #80292
- -    http://www.faqs.org/rfcs/rfc1855.html    Please, don't Cc: me.


Reply to: