Re: [PATCH] t6423-merge-rename-directories.sh: use the $(...) construct for command substitution
From: Derrick Stolee <hidden>
Date: 2022-02-22 14:06:51
On 2/22/2022 3:46 AM, Elia Pinto wrote:
The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.
The backquoted form is the traditional method for command
substitution, and is supported by POSIX. However, all but the
simplest uses become complicated quickly. In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.This message has some strange left-padding. Could you reduce that whitespace for the majority of your message?
The patch was generated by:
for _f in $(find . -name "*.sh")
do
shellcheck -i SC2006 -f diff ${_f} | ifne git apply -p2
doneHaving some left-padding makes sense for this example. Also, thanks for sharing this automation!
and then carefully proof-read. - for i in `git ls-files`; do echo side A >>$i; done && + for i in $(git ls-files); do echo side A >>$i; done &&
- for i in `git ls-files`; do echo side B >>$i; done && + for i in $(git ls-files); do echo side B >>$i; done &&
- for i in `git ls-files`; do echo side A >>$i; done && + for i in $(git ls-files); do echo side A >>$i; done &&
- for i in `git ls-files`; do echo side B >>$i; done && + for i in $(git ls-files); do echo side B >>$i; done &&
- for i in `test_seq 1 88`; do + for i in $(test_seq 1 88); do
These changes make sense. Thanks! -Stolee