RE: [PATCH v2] selftests/ftrace: Use printf for backslash included command
From: David Laight
Date: Mon May 11 2020 - 10:59:26 EST
> > + pos=$(printf "%s" "${2%^*}" | wc -c) # error position
> > + command=$(printf "%s" "$2" | tr -d ^)
You may want to put all the $(...) inside "" to avoid field splitting
(not relevant to a shell assignment with modern shells) and
filename globbing.
> > 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.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)