Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command

From: Steven Rostedt
Date: Mon May 11 2020 - 16:28:46 EST


On Mon, 11 May 2020 14:59:20 +0000
David Laight <David.Laight@xxxxxxxxxx> 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