Is there some way to get bash into a sort of verbose mode where, such that, when it\'s running a shell script, it echoes out the command it\'s going to run before running it? T
It's possible to use bash's printf in conjunction with the %q format specifier to escape the arguments so that spaces are preserved:
printf
%q
function echo_and_run { echo "$" "$@" eval $(printf '%q ' "$@") < /dev/tty }