Hm, I write bash scripts routinely and never do it that way. Always develop and run my scripts as files, starting with ‘set -x’ if I need debug info. I keep interactive mode solely for command line work, not development of scripts I plan to from files.