I found a script which used this "trick" to achieve a toggle between running and printing commands:
echo_prefix="echo" rm_cmd="rm file1 file2" $echo_prefix $rm_cmd
This allows the user to dry run the script and then set
to effectively run the script.
Still, I found many problems related to globbing and quoting so I was looking for a different and more robust approach.