Re: How come math/arithmetic cannot work by set -x

2022-08-12 Thread Greg Wooledge
On Sat, Aug 13, 2022 at 06:51:04AM +0700, Budi wrote:
> It doesn't work means no use on set -x, no value is shown

set -x shows the command being executed, with arguments expanded.


unicorn:~$ cat foo
#!/bin/bash
set -x

a=5
b=7
c=$((a * b))
echo "$c"
unicorn:~$ ./foo
+ a=5
+ b=7
+ c=35
+ echo 35
35


In this case, $((a * b)) was expanded to 35 before executing the variable
assignment, so that's what set -x shows.  Similarly, "$c" was expanded
to 35, so set -x shows that as well.

What *exactly* were you expecting?  We're all being forced to guess, and
it's obnoxious.



Re: How come math/arithmetic cannot work by set -x

2022-08-12 Thread Lawrence Velázquez
On Fri, Aug 12, 2022, at 7:40 PM, Dennis Williamson wrote:
> 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.

I'm guessing that instead of, for example

% bash -xc 'a="(x=1)" b="2*3"; ((a+b))'
+ a='(x=1)'
+ b='2*3'
+ (( a+b ))

they want something like

% bash -xc 'a="(x=1)" b="2*3"; ((a+b))'
+ a='(x=1)'
+ b='2*3'
+ (( a+b ))
+ (( (x=1)+2*3 ))
+ (( 1+6 ))
+ (( 7 ))

or whatever.  Who knows.

-- 
vq



Re: How come math/arithmetic cannot work by set -x

2022-08-12 Thread Dennis Williamson
On Fri, Aug 12, 2022 at 6:51 PM Budi  wrote:

> It doesn't work means no use on set -x, no value is shown
>
> On 8/13/22, Dennis Williamson  wrote:
> > On Fri, Aug 12, 2022, 6:28 PM Budi  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.


Re: How come math/arithmetic cannot work by set -x

2022-08-12 Thread Budi
It doesn't work means no use on set -x, no value is shown

On 8/13/22, Dennis Williamson  wrote:
> On Fri, Aug 12, 2022, 6:28 PM Budi  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.
>
>>
>



Re: How come math/arithmetic cannot work by set -x

2022-08-12 Thread Dennis Williamson
On Fri, Aug 12, 2022, 6:28 PM Budi  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.

>


How come math/arithmetic cannot work by set -x

2022-08-12 Thread Budi
How come math/arithmetic ((i=k+l)) cannot make use of set -x

Please help..
(so annoying).



Re: Should the readline *-meta flags reset when $LANG changes?

2022-08-12 Thread Chet Ramey

On 8/11/22 5:56 PM, Koichi Murase wrote:


I agree with option 4. Thank you for all your explanations.

--

Can we also change the behavior of TERM in a similar way with option
4?  


I'll look at that for the next version.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/