title: How to get Erlang's release version number from a shell?
body: <p>Many programs return their version number with a command like:</p>
  <pre><code>$ program --version
  program (platform info) v1.2.3
  </code></pre>
  <p>This is useful for scripting the installation or maintenance of the program, and some other controlled automation magic from System Admins and friends.</p>
  <h2>Problem</h2>
  <p><em>How to easily get the version number for Erlang (OTP)</em>?</p>
  <h2>On the net</h2>
  <p>Here are some unsatisfactory solutions (from the <a href="http://forum.trapexit.org/viewtopic.php?p=42946" rel="noreferrer">trapexit forum</a> and other tutorials/Erlang documentation):</p>
  <p><strong>Emulator</strong></p>
  <pre><code>$ erl
  1&gt; erlang:system_info(otp_release).
  &quot;R13B03&quot;
  </code></pre>
  <p>Hard to script. I have not found a way to have <code>erl</code> execute a single command from a shell prompt.</p>
  <p><strong>Release file</strong></p>
  <pre><code>$ cat /usr/lib/erlang/releases/RELEASES
  [{release,&quot;OTP  APN 181 01&quot;,&quot;R13B03&quot;,&quot;5.7.4&quot;,
        [{kernel,&quot;2.13.4&quot;,&quot;/usr/lib/erlang/lib/kernel-2.13.4&quot;},
         {stdlib,&quot;1.16.4&quot;,&quot;/usr/lib/erlang/lib/stdlib-1.16.4&quot;},
         {sasl,&quot;2.1.8&quot;,&quot;/usr/lib/erlang/lib/sasl-2.1.8&quot;}],
        permanent}].
  </code></pre>
  <p>Parsing paradise (with shell).</p>
  <p>An alternative could also be checking the install path, but that is not portable (my install path does not include the version, for one).</p>
  <p>Personal context: I am writing a script to install the same version of RabbitMQ with plugins on several machines. Some plugins have minimal requirements on the OTP version, and it is how this question started.</p>