bug-bash
[Top][All Lists]
Advanced

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

left bit shift (<<) operator now demands line continuation


From: jwm
Subject: left bit shift (<<) operator now demands line continuation
Date: Wed, 27 Jan 2010 14:34:09 -0500 (EST)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: 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../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux boost 2.6.31-17-server #54-Ubuntu SMP Thu Dec 10 18:06:56 
UTC 2009 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.0
Patch Level: 33
Release Status: release

Description:
bash 4.0 fails to parse a function that's parsed successfully by dash(1) as
well as older versions of bash (3.1, 3.2):

[jwm@boost:pts/6 ~> cat inet
swap32_posix()
{
        local funcname=swap32_posix
        local arg
        for arg in "$@"; do
                echo $((
                        ($arg & 4278190080) >> 24 |
                        ($arg & 16711680) >> 8 |
                        ($arg & 65280) << 8 |
                        ($arg & 255) << 24
                ))
        done
}
[jwm@boost:pts/6 ~> bash -n inet
inet: line 6: unexpected EOF while looking for matching `)'
inet: line 14: syntax error: unexpected end of file
[jwm@boost:pts/6 ~> dash -n inet
[jwm@boost:pts/6 ~> 


Repeat-By:
This affects the *left* bit shift operator, but *not* the right bit shift
operator:

[jwm@boost:pts/6 ~> cat left.sh 
echo $((2 << 1
))
[jwm@boost:pts/6 ~> bash -n left.sh 
left.sh: line 1: unexpected EOF while looking for matching `)'
left.sh: line 3: syntax error: unexpected end of file
[jwm@boost:pts/6 ~> cat right.sh 
echo $((1 >> 2
))
[jwm@boost:pts/6 ~> bash -n right.sh
[jwm@boost:pts/6 ~>  




reply via email to

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