title: Why does this wmctrl script not move the windows
body: <pre><code>wmctrl -l | awk '{ if ($4 == "Android") print $4" "$5" "$6" "$7" "}' | while read -r line;do wmctrl -r \"$line\" -e 1,0,0,100,100; done
  </code></pre>
  
  <p>Ok I know that is a bit hard to read, let me break it up.</p>
  
  <pre><code>wmctrl -l
  </code></pre>
  
  <p>will list all the windows controlled by wmctrl. My output is the following.</p>
  
  <pre><code>0x00800024 -1 DarkNetLab xfce4-panel
  0x02c00006 -1 DarkNetLab Desktop
  0x06806427  0 DarkNetLab mac@DarkNetLab: /opt/Analysis
  0x06000008  0        N/A Emulator
  0x06000003  0        N/A Android Emulator - droid8:5554
  0x0b800009  0        N/A Emulator
  0x0b800003  0        N/A Android Emulator - droid11:5556
  0x05400009  0        N/A Emulator
  0x05400003  0        N/A Android Emulator - droid9:5558
  </code></pre>
  
  <p>Then the awk (<code>| awk '{ if ($4 == "Android") print $4" "$5" "$6" "$7" "}'</code>) grabs all the lines who's 4th element is "Android" and prints the next 4 elements producing the following...</p>
  
  <pre><code>Android Emulator - droid8:5554
  Android Emulator - droid11:5556
  Android Emulator - droid9:5558
  </code></pre>
  
  <p>These are all the correct windows I want to move and need to be passed in with the -r argument for wmctrl</p>
  
  <p>Finally I use <code>| while read -r line;do wmctrl -r \"$line\" -e 1,0,0,100,100; done</code> to use each window like <code>Android Emulator - droid8:5554</code> to move the window with the wmctrl command.</p>
  
  <p>NO WINDOWS MOVE!!</p>
  
  <p>If I change the code to <code>wmctrl -l | awk '{ if ($4 == "Android") print $4" "$5" "$6" "$7" "}' | while read -r line;do echo "wmctrl -r \"$line\" -e 1,0,0,100,100"; done</code> in order to echo the command that should be executed, I get the following.</p>
  
  <pre><code>wmctrl -r "Android Emulator - droid8:5554" -e 1,0,0,0,100,100
  wmctrl -r "Android Emulator - droid11:5556" -e 1,0,0,0,100,100
  wmctrl -r "Android Emulator - droid9:5558" -e 1,0,0,0,100,100
  </code></pre>
  
  <p>If I then copy and paste any of the lines into terminal and execute the terminal runs it correctly and moves the window.. So I'm wondering why the script doesn't work!</p>
  
  <p>Thanks in advance for the help, my guess is this is an issue with when/how bash evals commands and substitutes values for variables.</p>
  
  <p>Thanks for any help!</p>