title: how to silently disable xtrace in a shell script?
body: <p>I'm writing a shell script that loops over some values and run a long command line for each value. I'd like to print out these commands along the way, just like <code>make</code> does when running a makefile. I know I could just "echo" all commands before running them, but it feels inelegant. So I'm looking at <code>set -x</code> and similar mechanisms instead : </p>
  
  <pre><code>#!/bin/sh
  
  for value in a long list of values
  do
      set -v
      touch $value # imagine a complicated invocation here
      set +v
  done
  </code></pre>
  
  <p>My problem is: at each iteration, not only is the interresting line printed out, but also the <code>set +x</code> line as well. Is it somehow possible to prevent that ? If not, what workaround do you recommend ? </p>
  
  <p>PS: the MWE above uses <code>sh</code>, but I also have <code>bash</code> and <code>zsh</code> installed in case that helps.</p>