[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How come math/arithmetic cannot work by set -x
From: |
Dennis Williamson |
Subject: |
Re: How come math/arithmetic cannot work by set -x |
Date: |
Fri, 12 Aug 2022 19:22:10 -0500 |
On Fri, Aug 12, 2022 at 6:51 PM Budi <budikusasi@gmail.com> wrote:
> It doesn't work means no use on set -x, no value is shown
>
> On 8/13/22, Dennis Williamson <dennistwilliamson@gmail.com> wrote:
> > On Fri, Aug 12, 2022, 6:28 PM Budi <budikusasi@gmail.com> wrote:
> >
> >> How come math/arithmetic ((i=k+l)) cannot make use of set -x
> >>
> >> Please help..
> >> (so annoying).
> >>
> >
> >
> > It works for me. What are you expecting?
> >
> > It would help if you show what you're doing, the result you're getting
> and
> > what you expect instead.
> >
> > "It doesn't work" conveys no information whatsoever.
> >
> >>
> >
>
Hmmm... interesting.
$ set -x; unset a; b=2; c=7; ((a = $b + $c)); echo "$a $b $c"; set +x
+ unset a
+ b=2
+ c=7
+ (( a = 2 + 7 ))
+ echo '9 2 7'
9 2 7
+ set +x
shows the values in the arithmetic expression, but
set -x; unset a; b=2; c=7; ((a = b + c)); echo "$a $b $c"; set +x
+ unset a
+ b=2
+ c=7
+ (( a = b + c ))
+ echo '9 2 7'
9 2 7
+ set +x
without the dollar signs doesn't.
Also, note that this message includes a thorough example of doing, result,
expecting.
--
Visit serverfault.com to get your system administration questions answered.