bug-bash
[Top][All Lists]
Advanced

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

Not operator (~) fail on arithmetic expansion.


From: Bize Ma
Subject: Not operator (~) fail on arithmetic expansion.
Date: Sun, 27 Nov 2016 16:33:47 -0400

Configuration Information: 
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 
uname output: Linux zeus 4.8.0-1-amd64 #1 SMP Debian 4.8.5-1 (2016-10-28) x86_64 GNU/Linux 
Machine Type: x86_64-pc-linux-gnu 

Bash Version: 4.4 
Patch Level: 5 
Release Status: release 

Description: 
  The ~ operator is called not, and does a one's complement of the following value. That works correctly with  

   $ echo $(( ~1 )) 
   -2 

Even with 

   $ echo $(( ~0 )) 
   -1 

But fails with this: 

   $ echo $((~0)) 
   bash: /home/user: syntax error: operand expected (error token is "/home/user")        



Repeat-By: 
    
  Use $((~0)) (without spaces) to generate the error.

reply via email to

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