bug-bash
[Top][All Lists]
Advanced

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

Re: Error message garbage when parameter expansion used inside (()) and


From: Greg Wooledge
Subject: Re: Error message garbage when parameter expansion used inside (()) and variable unset
Date: Tue, 3 Apr 2018 08:09:37 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Mon, Apr 02, 2018 at 04:16:54PM -0500, PRussell wrote:
> The above tells us what happens to an unset variable if not using parameter
> expansion.
> 
> But if a shell variable uses parameter expansion and is null or unset, what
> does it evaluate to inside (()) syntax?  

The parameter expansion is performed exactly as you would expect,
resulting in an empty string, and most likely a syntax error.

> ./tt: line 18: var1: var1 ==  : syntax error: operand expected (error token 
> is "==  ")

Yes, like that.  So don't do that.  This is a bug in your script, not
in bash.



reply via email to

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