From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3223 invoked by alias); 5 Feb 2016 10:37:58 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21238 Received: (qmail 6798 invoked from network); 5 Feb 2016 10:37:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 Message-ID: <56B47B7F.3050204@inlv.org> Date: Fri, 05 Feb 2016 10:37:51 +0000 From: Martijn Dekker User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Re: Suppress tracing of "set +x" References: <20151230104531.GA20496@linux.vnet.ibm.com> <5683F898.7010907@inlv.org> <20160205100902.GA14979@linux.vnet.ibm.com> In-Reply-To: <20160205100902.GA14979@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Dominik Vogt schreef op 05-02-16 om 10:09: > I want only "some command" traced, not "RC=$?". Try this: exec 9>&2 # reserve file descriptor for tracing trace() { local cmd=$(printf '%q ' "$@") printf '+ %s\n' "$cmd" 2>&9 "$@" } trace some command This will only work for simple commands, not for grammatical constructs nor for anything with a function-local scope. (The above code should also work on bash and ksh93.) HTH, - M.