Radek Sprta (Posts about phpmyadmin)https://radeksprta.eu/categories/phpmyadmin.atom2024-01-07T02:28:56ZRadek SprtaNikolaOne-liner to Download Latest PHPMyAdminhttps://radeksprta.eu/posts/one-liner-to-download-latest-phpmyadmin/2020-07-01T16:49:55+02:002020-07-01T16:49:55+02:00Radek Sprta<p>Even though the PHPMyAdmin's heyday is long gone by, it still remains quite popular. However,
unless you are running it as a Docker container or similar, it is difficult to maintain updated.
The reason being, that the creators do not offer any direct link to get the latest version. And
the version in system repositories is usually few releases behind.</p>
<p>Luckily, their website design has remained fairly stale, so you can scrape the download link
from there. The bash one-liner below (split into three lines for readability :)) will achieve
just that:</p>
<div class="code"><pre class="code literal-block">curl<span class="w"> </span>https://www.phpmyadmin.net/files/<span class="w"> </span><span class="m">2</span>>/dev/null<span class="w"> </span><span class="se">\</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span>-oP<span class="w"> </span><span class="s1">'(?<=href=")https://files.phpmyadmin.net/phpMyAdmin[^"]*(?=")'</span><span class="w"> </span><span class="se">\</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span>head<span class="w"> </span>-n<span class="w"> </span><span class="m">1</span>
</pre></div>
<p>It uses the nifty lookbehind feature (<code>(?<=)</code>) of the Perl-like expression matching. But that
is specific to GNU Grep, so you might need to install it, if you are on BSD or MacOS.</p>