I would like to get output from
xdotool getactivewindow getwindowgeometry --shell
to local variables in bash.
Thought I might could do something like:
declare -A wp=( $(xdotool getactivewindow getwindowgeometry --shell | \ sed 's/\(^[^=]*\)/[\1]/') ) # sub gives: # [WINDOW]=48926121 # [X]=366 # [Y]=96 # [WIDTH]=819 # [HEIGHT]=1022 # [SCREEN]=0
But this fails with
must use subscript when assigning associative array
another way is to declare local all known values of output and use
eval. A safer is to grep, sed or the like six times for each of the values.
Both of these seems very wonky. Is there a better way? Some way to do it in one swoop?