RE: Strange assignment - new version (UNCLASSIFIED)

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

 



According to the bash manpage on RHEL5.4:
       Constants with a leading 0 are interpreted as octal numbers.  A
leading
       0x  or  0X  denotes  hexadecimal.   Otherwise,  numbers  take
the form
       [base#]n, where base is a decimal number between 2 and 64
representing
       the arithmetic base, and n is a number in that base.  If base# is
omit-
       ted, then base 10 is used.  The digits greater than 9  are
represented
       by  the  lowercase  letters,  the  uppercase letters, @, and _,
in that
       order.  If base is less than or equal to 36,  lowercase  and
uppercase
       letters may be used interchangeably to represent numbers between
10 and
       35.

However, I am running RHEL5.4 and can't duplicate your output with the
commands you use.  I am able to duplicate it when I enclose $D in $((
)).

RHEL5.4:
$ D=044
$ echo $D
044
$ echo $(( $D ))
36
$ D=08
$ echo $D
08
$ echo $(( $D ))
bash: 08: value too great for base (error token is "08")

RHEL4.8 behaves the same as your RHEL4 example despite the fact that the
manpage says the same thing as the RHEL5.4 manpage.

--Maarten

>  -----Original Message-----
>  From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-
>  bounces@xxxxxxxxxx] On Behalf Of Glasgow, Steven Mr CIV USA TRADOC
>  Sent: Monday, January 03, 2011 11:27 AM
>  To: redhat-list@xxxxxxxxxx
>  Cc: Gach, Terry CIV USA TRADOC; Tkacheff CIV Jeffrey C
>  Subject: Strange assignment - new version (UNCLASSIFIED)
>  
>  Classification: UNCLASSIFIED
>  Caveats: NONE
>  
>  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?
>  
>  Thanks in advance,
>  Steve
>  
>  
>  Classification: UNCLASSIFIED
>  Caveats: NONE
>  
>  
>  
>  --
>  redhat-list mailing list
>  unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
>  https://www.redhat.com/mailman/listinfo/redhat-list


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list


[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux