Revision e1fdeef1-2f30-4dcb-88f3-5cb6ec367dc2 - Code Golf Stack Exchange
# POSIX sh: ([Dash], [Bash], [Zsh]), 42 bytes
<!-- language-all: lang-sh -->
<pre><code>set ${2-1} $((2ドル+${1-1}))
trap echo\ 1ドル 0
</code></pre>
[Try it online!][TIO-llsdb6g2]
[Dash]: https://wiki.debian.org/Shell
[Bash]: https://www.gnu.org/software/bash/
[Zsh]: https://www.zsh.org/
[TIO-llsdb6g2]: https://tio.run/##XY5NCsIwEIX3OcUDA22QQCfblu506wVctLSjLehEm6qL4tljuhDB1fCY7/30bRhi186oCVWV7Q77LAaeoRdn6Q2d59pt9UJJGKPmqb2Bu8EfoQmFiolXaoOJr/7JSO/xMsoZwq90OfEPSeEMG2AJpNTJTxCMgibwHQ6uaMreY11Aa5tYMgY1tJTofYr4c9DXEYYfEz8 "Dash – Try It Online"
We use `trap [snippet] 0` to output upon EXIT.
(I'm not personally a fan of `\r` clearing, you will see the previous lines if your terminal width is small enough.)
Bash can **save 2 bytes** with `set ${2-1} $[2ドル+${1-1}]`, Zsh can **save 3 bytes** by also using `trap '<<<1ドル' 0`.