help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Arithmetic evaluation / expansion question


From: Bruce Hohl
Subject: Re: [Help-bash] Arithmetic evaluation / expansion question
Date: Thu, 11 Oct 2018 00:36:21 +0000

> In an arithmetic context, pd is evaluated identically to $pd ...
I do understand that as it is described in the man page.  For arithmetic
evaluation, the man page also indicates that null or unset variables
evaluate to zero.

I have noted through "observation" (per the original example) that a
defined variable which holds a string not beginning with zero (non-octal)
also is "arithmetically" evaluated to zero.  Is that behavior as intended?
I.E. can that behavior be relied upon?  I admit I did not read the entire
man page. ;)




On Thu, Oct 11, 2018 at 12:05 AM Andy Chu <address@hidden> wrote:

>
> I noted in the man page that null or unset variables evaluate to zero.
>> Above, pd is a defined variable which holds "abc" (a string not beginning
>> with zero - non-octal)
>> pd is "arithmetically" evaluated to zero.  Is this as intended?  I.E. can
>> this behavior be relied upon?
>>
>
> In an arithmetic context, pd is evaluated identically to $pd, so yes.
> Just think of it as the $ being optional.
>
> Andy
>
>
>
>


reply via email to

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