Consider:
heightScaled=$(bc <<< $H*$S/1)
echo $heightScaled
45.0
Why am I getting 45.0 despite the same operations yielding 45 if used outside the script either interactively or piped into bc?
H is an int(30) and S is a float(1.5)
Here's my code:
S=$(awk '/monitor =/ {print $6}' ~/.config/hypr/config/monitor.conf)
H=$(hyprctl layers 2>/dev/null | awk '/waybar/ {print substr($7, 1, length($7)-1)}')
if [ -z $H ]; then
H=0
fi
heightScaled=$(bc <<< "$H*$S/1")
echo "$heightScaled"