title: How to reset a variable value after running a certain command in bash
body: <p>i wanted to implement a cool feature for my PS1 prompt. I added \# string to show the command number of that command. My goal is that if a certain command is ran, the command number from \# to be set back to 1. I have some ideas but i don't know how to write it.<br>
  Is it possible to somehow export \# value as a variable, and when a command is run, the variable to be restored to the initial state. Actually this <a href="https://unix.stackexchange.com/a/434401/469653">post</a> says that its impossible.<br>
  If this doesn't work, can i create a counter that replaces \#, and then export it as a variable. That variable to be reset by a certain command.<br>
  <a href="https://www.baeldung.com/linux/bash-script-counter" rel="nofollow noreferrer">https://www.baeldung.com/linux/bash-script-counter</a><br>
  Sorry i don't have enough knowladge in bash, hope i don't ask for the impossible. Thanks</p>