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.

Reply via email to