From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 247BBC54E8D for ; Mon, 11 May 2020 20:28:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09FBC206A3 for ; Mon, 11 May 2020 20:28:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731705AbgEKU2p (ORCPT ); Mon, 11 May 2020 16:28:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:36584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbgEKU2p (ORCPT ); Mon, 11 May 2020 16:28:45 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CEFC220661; Mon, 11 May 2020 20:28:43 +0000 (UTC) Date: Mon, 11 May 2020 16:28:42 -0400 From: Steven Rostedt To: David Laight Cc: 'Masami Hiramatsu' , Shuah Khan , "linux-kselftest@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Tom Zanussi , Li Philip , Liu Yiding , Xiao Yang , Andreas Schwab Subject: Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command Message-ID: <20200511162842.7c198741@gandalf.local.home> In-Reply-To: References: <87imh21x6f.fsf@igel.home> <158920418730.16156.8299185499520876735.stgit@devnote2> <20200511223804.9483cab03c9221818ff4fc5b@kernel.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 May 2020 14:59:20 +0000 David Laight wrote: > > > echo "Test command: $command" > > > echo > error_log > > > - (! echo "$command" >> "$3" ) 2> /dev/null > > > + (! printf "%s" "$command" >> "$3" ) 2> /dev/null > > WTF is the (! for ?? > The (...) is a subshell. > And ! inverts the exit status. > Neither is needed at all. This is done because the scripts are run with '-e' and will exit the script on any error. This particular test is examining errors in the error log. The command being written into $3 is going to fail, and return an exit code. The "(! ..)" is needed, otherwise that failure will exit out the script. -- Steve