[AKO Warning - Message fails DKIM verification] RE: Strange assignment (UNCLASSIFIED)
Glasgow, Steven Mr CIV USA TRADOC
Steven.Glasgow at us.army.mil
Mon Jan 3 20:05:58 UTC 2011
Classification: UNCLASSIFIED
Caveats: NONE
Maarten, It looks to me that set creates a "string" variable while @
creates a "numeric" one. There was a bug in tcsh which was corrected
between RHEL 4.7 and RHEL 5.4. All numbers beginning with 0 should be
considered octal and they were not prior to this fix. 44 octal is 36
decimal.
This stemmed from the following command I had in one of my scripts:
@ D=`date +\%m%d%y`
This should have returned 10311, but because %m is 01, the string 010311
was being considered octal and D was getting assigned the value 4297
(10311 converted from octal to decimal).
Using set works just fine if I want the leading 0 on the month. If not,
this command works too:
@ D=`date +\%-m%d%y`
The "-" removes the leading 0 from the month and D gets assigned the
value 10311.
Thanks again,
Steve
-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com] On Behalf Of Broekman, Maarten
Sent: Monday, January 03, 2011 1:31 PM
To: General Red Hat Linux discussion list
Subject: [AKO Warning - Message fails DKIM verification] RE: Strange
assignment (UNCLASSIFIED)
Try using 'set' instead of '@'. From the behavior, it seems like '@'
will perform math on the values in the assignment whereas set doesn't.
Not sure why the difference though.
[tcsh]$ set D=044 ; echo $D
044
[tcsh]$ @ D=044 ; echo $D
36
--Maarten
> -----Original Message-----
> From: redhat-list-bounces at redhat.com [mailto:redhat-list-
> bounces at redhat.com] On Behalf Of Glasgow, Steven Mr CIV USA TRADOC
> Sent: Monday, January 03, 2011 1:20 PM
> To: General Red Hat Linux discussion list
> Subject: RE: Strange assignment (UNCLASSIFIED)
>
> Classification: UNCLASSIFIED
> Caveats: NONE
>
> Both /bin/tcsh and /bin/csh have the same results.
>
> Steve
>
> -----Original Message-----
> From: redhat-list-bounces at redhat.com
> [mailto:redhat-list-bounces at redhat.com] On Behalf Of m.roth at 5-cent.us
> Sent: Monday, January 03, 2011 10:43 AM
> To: General Red Hat Linux discussion list
> Subject: Re: Strange assignment (UNCLASSIFIED)
>
> Glasgow, Steven Mr CIV USA TRADOC wrote:
> >
> > To anyone that can help,
> >
> > Something has changed between RHEL 4.7 and RHEL 5.4...
> >
> > RHEL 4.7:
> >
> > @ D=44 ; echo $D returns 44
> > @ D=044 ; echo $D returns 44
> > @ D=08 ; echo $D returns 8
> >
> > RHEL 5.4:
> >
> > @ D=44 ; echo $D returns 44
> > @ D=044 ; echo $D returns 36 --- HUH?
> > @ D=08 ; echo $D returns @: Badly formed number --- HUH?
> >
> > Seems to be an octal thing going on. Would anyone be able to shed
> some > light on this and how I might get 5.4 to act more like 4.7?
>
> What shell?
>
> mark
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
> Classification: UNCLASSIFIED
> Caveats: NONE
>
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
Classification: UNCLASSIFIED
Caveats: NONE
More information about the redhat-list
mailing list