[ale] Bash confusion

Jim Kinney jim.kinney at gmail.com
Wed Jul 20 12:00:21 EDT 2011


I get the same results on a new system (CEntOS 5.6).

The comparison _should_ not "see" the \n

On Wed, Jul 20, 2011 at 11:45 AM, Charles Shapiro
<hooterpincher at gmail.com>wrote:

> 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
> >
>
> _______________________________________________
> 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/c3795c0c/attachment.html 


More information about the Ale mailing list