[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Bash confusion
- Subject: [ale] Bash confusion
- From: jim.kinney at gmail.com (Jim Kinney)
- Date: Wed, 20 Jul 2011 11:47:01 -0400
- In-reply-to: <[email protected]>
- References: <[email protected]>
#!/bin/bash
yesteday=$(date -d 'yesterday' +%_d)
today=$(date +%_d)
if [ $today -lt $yesterday ]; then
monthly
else
incremental
fi
On Wed, Jul 20, 2011 at 11:41 AM, Robert L. Harris <
robert.l.harris at gmail.com> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Ok, simple one... I have a script that has this:
>
>
> #!/bin/bash
>
> date=`date +%d`
> if [ $date = "01" ]; then
> # Run Monthly Backup
> else
> # Run Incremental Backup
> fi
>
> - From the man page of 'date':
> %d day of month (e.g, 01)
>
> And when I set it up last year, it did run a full on 11/01/2010. But
> now it's not. Going to convert it to a numerical '-eq' comparison but
> it's still got me wondering why it's picking the wrong date. Any ideas?
>
> Robert
>
> - --
>
> :wq!
> ====================================================================
> Robert L. Harris | GPG Key ID: E344DA3B
> @ x-hkp://pgp.mit.edu
> DISCLAIMER:
> These are MY OPINIONS With Dreams To Be A King,
> ALONE. I speak for First One Should Be A Man
> no-one else. - Manowar
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iEYEARECAAYFAk4m9x8ACgkQ8+1vMONE2jvuSgCgmi/771au8rOxhSLm0iwfuJ4x
> aV8AnjfTb/21A/w4PBUfCnZ1G7CcPKxl
> =UYaq
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
--
--
James P. Kinney III
As long as the general population is passive, apathetic, diverted to
consumerism or hatred of the vulnerable, then the powerful can do as they
please, and those who survive will be left to contemplate the outcome.
- *2011 Noam Chomsky
http://heretothereideas.blogspot.com/
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20110720/9b39a6a6/attachment.html