[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
>
>
>
>
- [Help-bash] Arithmetic evaluation / expansion question, Bruce Hohl, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question, Andy Chu, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question, Greg Wooledge, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question, Andy Chu, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question, Andy Chu, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question, Bruce Hohl, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question, Andy Chu, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question,
Bruce Hohl <=
- Re: [Help-bash] Arithmetic evaluation / expansion question, Quentin L'Hours, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question, Bruce Hohl, 2018/10/10
- Re: [Help-bash] Arithmetic evaluation / expansion question, Chet Ramey, 2018/10/11
- Re: [Help-bash] Arithmetic evaluation / expansion question, Chet Ramey, 2018/10/11
Re: [Help-bash] Arithmetic evaluation / expansion question, Chet Ramey, 2018/10/11
Re: [Help-bash] Arithmetic evaluation / expansion question, Chet Ramey, 2018/10/11