title: POSIX Shell sh get currently executed line number
body: <p>How to get currently executed line number in POSIX shell script?
  For example I have a script:</p>
  <pre><code>#!/bin/sh
  
  set -eu
  
  echo &quot;A&quot;
  echo &quot;B&quot;
  
  echo &quot;Script '$0' error at line no: &lt;line-no&gt;&quot;
  exit 1
  
  echo &quot;C&quot;
  </code></pre>
  <p>and I would like get in place of <code>&lt;line-no&gt;</code> the current line of the script so the output is for eg:</p>
  <p>Script 'script.sh' error at line no: 8</p>