I need to do some calculations in a "#!/bin/bash" shell script, but I cannot seem to get the syntax right. In PHP, I would have written:
$zosx = ( $x + round( $w * 0.25 ) );
$zosy = ( $y + round( $h * 0.75 ) );
$zoex = ( $x + round( $w * 0.5 ) );
$zoey = ( $y + round( $h / 2 ) );
May I ask someone to give me the right syntax for a shell script?
For context, what comes before these math calculations is:
unset x y w h
eval $(xwininfo -id $(xdotool getactivewindow) |
sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
-e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
-e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
-e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
This is running on a typical Debian 11 system.