This command will display each line after the variables and
metacharacters have been substituted:
#!/bin/sh -xv
It is not necessary to modify the program. You can enable variable
tracing in Bourne shell scripts by typing the shell name and options
on the command line:
$ sh -v script
$ sh -x script
Not all Bourne shells let you turn these options off. If yours does
(and it probably does), you can do it by using a plus sign instead of
a minus sign:
set +xv