When I’m working on a little bash script, I’ll often make a backup, each time I save and test. Then I can revert back, if I need to. The syntax I’ll use is to cp and then curly-bracket the output into .bak files (that’s a 90s era file extension I use for such nonsense):
cp filename.sh{,.bak}
So if I’m writing a script called MYSCRIPT.sh:
cp MYSCRIPT.sh{,.bak}
The resultant backup of the script is MYSCRIPT.sh.bak.