Harald<p>Today I found that bash uses dynamic scoping, not lexical scoping. So if you have a</p><p>function inner() {<br> echo "$x"<br>}</p><p>it will go up the call stack to find the first x defined as </p><p>local x</p><p>in any caller and print it. Pity (add more swearwords here)🙁 . There is a reason why emacs lisp is being converted to lexical scoping despite having decades of dynamic binding history.</p><p><a href="https://nrw.social/tags/bash" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>bash</span></a> <a href="https://nrw.social/tags/dynamicscoping" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dynamicscoping</span></a> <a href="https://nrw.social/tags/lexicalscoping" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>lexicalscoping</span></a> <a href="https://nrw.social/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a> <a href="https://nrw.social/tags/scripting" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>scripting</span></a> </p><p><a href="https://stackoverflow.com/a/48166252/2954288" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">stackoverflow.com/a/48166252/2</span><span class="invisible">954288</span></a></p>