Article 4XRHD [SOLVED] bash arithmetic evaluation null variable strange behavior

[SOLVED] bash arithmetic evaluation null variable strange behavior

by
doru
from LinuxQuestions.org on (#4XRHD)
a is unset. Why would this happen?
Code:$ echo $(($a+1))
1
$ echo $((1+$a))
bash: 1+: syntax error: operand expected (error token is "+")
$ bash --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>latest?d=yIl2AUoC8zA latest?i=ijAk-kjHPAU:4R7Ve531J3o:F7zBnMy latest?i=ijAk-kjHPAU:4R7Ve531J3o:V_sGLiP latest?d=qj6IDK7rITs latest?i=ijAk-kjHPAU:4R7Ve531J3o:gIN9vFwijAk-kjHPAU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments