Script
#!/bin/bash -v
echo "verbose echo"
{ set +v; } &>/dev/null
echo "non verbose echo"
gives the following output:
echo "verbose echo"
verbose echo
{ set +v; } &>/dev/null
non verbose echo
I want to suppress output for { set +v; } &>/dev/null
and get the following output:
echo "verbose echo"
verbose echo
non verbose echo
I tried the approach above which is described here for suppressing output for disabling xtrace
(x
) flag with command { set +x; } &>/dev/null
and it is working for this xtrace
flag. Have not found related info in manuals for bash
and set
.
As work around this can be achieved by means of subshell call like shown here. But is this possible without using subshell?