title: Travis CI: How do I escape my password for `travis encrypt` to work?
body: <p>The <a href="https://docs.travis-ci.com/user/encryption-keys/#note-on-escaping-certain-symbols" rel="nofollow noreferrer">travis encryption docs</a> mention that I have to bash-escape my password before encrypting it:</p>
  <blockquote>
  <p><strong>Note on escaping certain symbols</strong></p>
  <p>When you use travis encrypt to encrypt sensitive data, it is important to note that it will be processed as a bash statement. This means that secret you are encrypting should not cause errors when bash parses it. Having incomplete data will cause bash to dump the error statement to the log, which contains portions of your sensitive data.</p>
  <p>Thus, you need to escape special characters such as braces, parentheses, backslashes, and pipe symbols. For example, when you want to assign the string <code>6&amp;a(5!1Ab\</code> to <code>FOO</code>, you need to execute:</p>
  <p><code>travis encrypt &quot;FOO=6\\&amp;a\\(5\\!1Ab\\\\&quot;</code></p>
  </blockquote>
  <p>The answer for bash seems to revolve around <a href="https://stackoverflow.com/a/27817504"><code>printf &quot;%q&quot;</code></a>, but it's still too complicated to figure out how to wire <code>printf</code> with the <code>travis</code> cli.</p>
  <p><strong>What's the bash one-liner for having <code>travis encrypt</code> do what it's supposed to do?</strong></p>
  <p>I mean, I want to paste my variable name and its value and be sure that it will be encrypted properly, without having to worry about bash escaping. We can stay with the example above, assuming I want to assign the string <code>6&amp;a(5!1Ab\</code> to the variable <code>FOO</code>.</p>
  <p>And while we're at it, what would be the corresponding one-liner for <code>travis env set</code>? That would help those fighting with the <code>data too large</code> error.</p>