[ale] Bash confusion

Charles Shapiro hooterpincher at gmail.com
Wed Jul 20 11:45:05 EDT 2011


Newline character?

On a really old system I get:

foo# date +%d | od -c
0000000   2   0  \n
0000003


-- CHS

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
>



More information about the Ale mailing list