How to capture the file size from a URL and use it in Shell scripting
<pre><code>URL_C="any url"
length_C=$(curl -sI $URL_C | grep Content-Length | cut -d ' ' -f 2)
answer_C=$(awk -v len=$length_C 'BEGIN{printf "%.0f\n", len/1024}')
</code></pre>

<p>Will the variable <code>$answer_C</code> capture the file size ? </p>

<p>Is <code>Content-Length</code> the correct way ?</p>