Query Apple's Servers for Update Using Script?
Apple has pages up beneath https://support.apple.com/en_US/downloads/ios for each major iOS release. Looking at About iOS 13 Updates one can see an overview of all available iOS13 versions.



In the HTML source this is coded as

&lt;p&gt;&lt;a href="#1341"&gt;&lt;img alt="" src="/library/content/dam/edam/applecare/images/en_US/il/spacer.png" width="76"&gt;iOS 13.4.1&lt;br&gt;
 &amp;nbsp;&amp;nbsp;&lt;/a&gt;
&lt;p&gt;&lt;a href="#135"&gt;&lt;img alt="" src="/library/content/dam/edam/applecare/images/en_US/il/spacer.png" width="76"&gt;iOS 13.5&lt;br&gt;
 &amp;nbsp;&amp;nbsp;&lt;/a&gt;
&lt;p&gt;&lt;a href="#1351"&gt;&lt;img alt="" src="/library/content/dam/edam/applecare/images/en_US/il/spacer.png" width="76"&gt;iOS 13.5.1&lt;br&gt;
 &amp;nbsp;&amp;nbsp;&lt;/a&gt;


So if you are willing to adapt your script with each major release of iOS/iPadOS you could use

curl -s "https://support.apple.com/en-us/HT210393" | \
    sed -n '/\/library\/content/s|.*width="76"&gt;\([^&lt;]*\)&lt;.*|\1|p' | \
    tail -1


to get the most recent version available (iOS 13.5.1 right now).


sed -n runs sed suppressing any printing output unless specifically told so
/\/library\/content/ applies the following command to all lines matching /library/content
s|STRING-TO-MATCH|REPLACEMENT| does pattern-based string replacement
.*width="76"&gt;\([^&lt;]*\)&lt;.* takes the whole line and puts the part between width="76"&gt; and the following &lt; into \1
\1 just replaces the whole line with the content of \1 (which in this case is the version number)
p prints the result to stdout


This obviously matches (and prints) every line (just leave out the tail to check) so at the end we just take the last line.

What changes for sure with each major release is the URL, what might change is the code to find and extract the relevant content from the page. The sed/tail combination above works for iOS12 and iOS13 at least.

PS: You could avoid tail by running

curl -s https://support.apple.com/en-us/HT210393 | \
    sed -n '/\/library\/content/{s|.*width="76"&gt;\([^&lt;]*\)&lt;.*|\1|;h;}; ${g;p;}'


but this makes it hard to read for most people :-)