[TriLUG] BASH oddity

Ian Kilgore ian at trilug.org
Tue Feb 21 18:30:47 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul G. Szabady wrote:
| That's what I thought, but other non-octal combinations work.
|
| IE
|
| [paul at at paul]$ declare -i dirx=88 ; echo $dirx
| 88
| [paul at at paul]$
|
|

~From bash(1):

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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD+6KnwsRpgTiXSOERAsBbAKCZwrnoe/Kxo1C07eztQAR/cn+d3wCePbl1
KQFo6/fa/WOvV2v+nFgAQA4=
=6zLn
-----END PGP SIGNATURE-----



More information about the TriLUG mailing list