On Tue, 12 Sep 2023 16:51:05 GMT, Erik Joelsson <er...@openjdk.org> wrote:

>> I recall there were some issues (I believe in some older versions of bash) 
>> when an empty shell variable was expanded in a if statement. I no longer 
>> remember the details, but it has become my habit to always quote shell 
>> variable [expansions].
>
>> I recall there were some issues (I believe in some older versions of bash) 
>> when an empty shell variable was expanded in a if statement. I no longer 
>> remember the details, but it has become my habit to always quote shell 
>> variable [expansions].
> 
> That does depend on the context. In this case the whole command line is 
> quoted, which is definitely something different and the cause for the 
> problem. I agree that variable references in conditionals should be quoted, 
> e.g.
> 
> 
> if [ "$foo" = "$bar" ]; then
> 
> or
> 
> if test "$foo" = "$bar"; then
> 
> 
> But in this case we aren't using `[]` or `test`, we are running a command 
> directly.

Noted @erikj79. Thanks for the clarification.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15592#issuecomment-1716188686

Reply via email to