I'm writing a script to execute tasks before my end to end tests. One of the steps is to select the branch where those tests were written. Sometimes the script changes between different branches so I need the script to update itself before the actual execution.
Is it possible for a bash script in my git repository to update itself and execute the new version only?
In summary: When I execute script.sh
I want it to check git if a new version is available and if so, download this new version and execute it while the old version simply dies.