title: How can you run a command in bash over and over until success?
body: <p>I have a script and want to ask the user for some information, but the script cannot continue until the user fills in this information. The following is my attempt at putting a command into a loop to achieve this but it doesn't work for some reason:</p>
  <pre class="lang-sh prettyprint-override"><code>echo &quot;Please change password&quot;
  while passwd
  do
      echo &quot;Try again&quot;
  done
  </code></pre>
  <p>I have tried many variations of the while loop:</p>
  <pre class="lang-sh prettyprint-override"><code>while `passwd`
  while [[ &quot;`passwd`&quot; -gt 0 ]]
  while [ `passwd` -ne 0 ]]
  # ... And much more
  </code></pre>
  <p>But I can't seem to get it to work.</p>