I first prototype operations as single command lines, then refactor those command lines as I migrate components of them to shell functions (often taking whatever unique token I want to use to distinguish runs). Eventually, when I'm satisfied with the behavior, I'll write the shell functions to a script with typeset -f, and then source the script later.
While it's not research-related (a lot of what I do at work is statistical analysis on server logs, but anything I develop at work I technically don't own & so can't post), a good example of this style is in my music synthesizer project: https://github.com/enkiv2/clisynth/blob/master/clisynth.sh ; all of the code in this file was prototyped at the command line.