In shell scripts I would like to echo some of the major (long running) commands for status and debug reason. I know I can enable an echo for all commands with set -x
or set -v
. But I don't want to see all the commands (specially not the echo commands). Is there a way to turn on the echo for just one command?
I could do like this, but that's ugly and echoes the line set +x
as well:
#!/bin/sh
dir=/tmp
echo List $dir
set -x
ls $dir
set +x
echo Done!
Is there a better way to do this?