Making script show command (e.g. copy) being executed and variable substitution?

When script is running you only see when some of the commands are not successfull.
Is there a way to see which command are executed and to show the substitution of variables as every line is executed ?

set -x

for each level of the process, including each function() within the script...alternately, you could also echo script pre-interpolation via

set -v

assuming ksh or bash...

Actually, assuming a posix-compliant shell. set -x and set -v are both standardized :wink:

Use the -v option of the cp command when copying files.

-v    Cause cp to be verbose, showing files as they are copied.

Check in the man pages if the commands you use also support this option or a similar one.