bug-bash
[Top][All Lists]
Advanced

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

Re: Assignment to integer variable


From: Pierre Gaston
Subject: Re: Assignment to integer variable
Date: Tue, 14 Sep 2010 18:15:53 +0300

On Tue, Sep 14, 2010 at 4:42 PM, Diego Augusto Molina
<diegoaugustomolina@gmail.com> wrote:
>
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: x86_64-pc-linux-gnu-gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib
> -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
> -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin'
> -DSYS_BASHRC='/etc/bash/bashrc'
> -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
> -DSSH_SOURCE_BASHRC -O2 -pipe
> uname output: Linux diegom 2.6.34-gentoo-r1 #4 SMP Thu Jul 22 21:06:07
> ART 2010 x86_64 Intel(R) Pentium(R) Dual CPU T2330 @ 1.60GHz
> GenuineIntel GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 4.0
> Patch Level: 37
> Release Status: release
>
> Description:
>        BASH complains when asigning some (didn't try all of them)
> non-ASCII characters to a variable with the integer attribute. Tried
> with vocal letters with an acute accent, grave accent, circumflex
> accent, 'Ñ', 'ñ', 'ç', 'Ç', and some more I can't remember by now. Hoped
> it would just do nothing, as happens when asigning anything that is not
> a number to a variable of this kind.
>  Thank you for BASH.
>
> Repeat-By:
>        declare -i variable
>        variable='á'
>
> --
>
> Diego Augusto Molina
> diegoaugustomolina@gmail.com
>

It doesn't complain only when you assign something that is a valid
variable name:
ie
declare -i var
var=foo # is fine foo is a variable an empty/unset variable is evaluated as 0
var="a b" # error

just for fun try:
foo=1+1+1
var=foo
echo "$foo $var"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]