What is the best way to test an Image script ?

If I create a script that doesn't work it disappears at once and the
device reboots.

I would like to run the script manually and see where it goes wrong.

/Joakim