Arithmetic operation in bash script, multiply by decimal number, how?

GNU bash, version 5.1.8(1)

How can i please do this in a bash script, i want to multiply certain number by decimal number 1.5

Non working attempts:

result=$(( $number * 1.5 |bc -l ))
                    ^---------------^ SC2004: $/${} is unnecessary on arithmetic variables.
                                        ^-^ SC2079: (( )) doesn't support decimals. Use bc or awk.
                                             ^-- SC2154: bc is referenced but not assigned (for output from commands, use "$(bc ...)" ).
                                                 ^-- SC2154: l is referenced but not assigned.
result=$(( $number * 1,5 ))
                    ^---------------^ SC2004: $/${} is unnecessary on arithmetic variables.
#!/bin/bash
number=3456
result=$( echo "$number*1.5"|bc )
echo "$result"

output is decimal (5184.0) which i do not want, i want whole numbers only result :-S

Hi @centosadmin,

one method is to divide by 1, which results in rounding down:

$ echo "(28*1.5)/1" | bc
42
$ echo "0.999/1" | bc
0
# or round to nearest integer
$ x=1.7; echo "($x^2+0.5)/1" | bc
3

Another method is to cut off the fractional part:

$ x=1.7; y=$(echo "$x^2" | bc); echo ${y%.*}
2

Like this?:

result=$(( number * 3 / 2 ))