Functions in shell scripts
Posted on 2006-05-02
I'm writing a script which is becoming a little on the lengthy side for easy management (>100 lines). Instead of having half-a dozen nested IFs, I've chosen to use a sequence of single-level IFs and a few control variables that are set during the IFs.
However, I don't want to have to trawl through all these IFs to be able to edit the main body of the program. I can use a function, but this still has to be defined before it's used.
Is there any way I can push this stuff down to the bottom of the script somewhere and leave me with all the nice stuff at the top to edit?