Chet Ramey wrote:
There have been several interesting discussions on this topic, most
centered on Linux:
https://groups.google.com/d/msg/linux.kernel/PYgS2MyNQfw/orRVLXtinOwJ
http://lists.gnu.org/archive/html/bug-readline/2012-07/msg4.html
http://lists.gnu.org/archive/html/bug-bash/2012-0
Description:
There is a bug when expanding this math:
$ echo "$((~0))"
bash: /home/user: syntax error: operand expected (error token is
"/home/user")
It works correctly when an space is added:
$ echo "$(( ~0 ))"
-1
Bash version:
$ echo "$BASH_VERSION"
4.4.12(1)-release
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/s