title: Relaunch program when grep returns a result
body: <p>I'm trying to write a little bash script that launch a wine .exe file (Photoshop). During the launch, if there is a boot error, the message "Assertion failed" is displayed.</p>
  
  <p>The concept would be:</p>
  
  <ol>
  <li>I launch Photoshop using wine</li>
  </ol>
  
  <p><code>wine64 "/home/artik/.wine/drive_c/Program Files/Adobe/Adobe Photoshop CC 2019/Photoshop.exe"</code></p>
  
  <ol start="2">
  <li>I grep the output, to see if a boot error occurs:</li>
  </ol>
  
  <p><code>2&gt;&amp;1 | grep -i Assertion</code></p>
  
  <ol start="3">
  <li>If there is an error, I stop the execution of wine using <code>pipefail</code>, and try to relaunch photoshop
  Looping this till it boots.</li>
  </ol>
  
  <p>I tried to write a little script that is obviously wrong. How to make it works?</p>
  
  <pre><code>#!/bin/sh
  
  set -euxo pipefail
  
  wine64 "/home/artik/.wine/drive_c/Program Files/Adobe/Adobe Photoshop CC 2019/Photoshop.exe" 2&gt;&amp;1 | grep -i -L Assertion
  
  if [ Assertion failed ]
  then
          wine64 "/home/artik/.wine/drive_c/Program Files/Adobe/Adobe Photoshop CC 2019/Photoshop.exe" 2&gt;&amp;1 | grep -i -L Assertion
  fi
  </code></pre>