title: Making echo "foo" | sudo tee -a idempotent
body: <p>I am using the following shell command to append a string to a file:</p>
  
  <pre><code>echo "latest stable main" | sudo tee -a /etc/my-app.conf &gt; /dev/null
  </code></pre>
  
  <p>However this is not idempotent, i.e. if the string already exists in <code>/etc/my-app.conf</code> it is appended multiple times each time the command is invoked. Is it possible to only append if it doesn't exist in a clever one-liner?</p>