Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH v2] selftests/ftrace: Use printf for backslash included command | Date | Mon, 11 May 2020 14:59:20 +0000 |
| |
> > + 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)
| |