{"thread":{"id":"57456","subject":"[PATCH] t6423-merge-rename-directories.sh: use the $(...) construct for command substitution","startedAt":"2022-02-22T08:47:32Z","lastAt":"2022-02-22T14:06:51Z","messageCount":2,"participants":["Elia Pinto","Derrick Stolee"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"449094","messageId":"20220222084646.115147-1-gitter.spiros@gmail.com","threadId":"57456","inReplyTo":null,"subject":"[PATCH] t6423-merge-rename-directories.sh: use the $(...) construct for command substitution","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2022-02-22T08:46:46Z","receivedAt":"2022-02-22T08:47:32Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"    The Git CodingGuidelines prefer the $(...) construct for command\n    substitution instead of using the backquotes `...`.\n\n    The backquoted form is the traditional method for command\n    substitution, and is supported by POSIX.  However, all but the\n    simplest uses become complicated quickly.  In particular, embedded\n    command substitutions and/or the use of double quotes require\n    careful escaping with the backslash character.\n\n    The patch was generated by:\n\n        for _f in $(find . -name \"*.sh\")\n        do\n           shellcheck -i SC2006 -f diff ${_f} | ifne git apply -p2\n        done\n\n    and then carefully proof-read.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n t/t6423-merge-rename-directories.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh\nindex 5b81a130e9..479db32cd6 100755\n--- a/t/t6423-merge-rename-directories.sh\n+++ b/t/t6423-merge-rename-directories.sh\n@@ -4421,14 +4421,14 @@ test_setup_12c1 () {\n \n \t\tgit checkout A &&\n \t\tgit mv node2/ node1/ &&\n-\t\tfor i in `git ls-files`; do echo side A >>$i; done &&\n+\t\tfor i in $(git ls-files); do echo side A >>$i; done &&\n \t\tgit add -u &&\n \t\ttest_tick &&\n \t\tgit commit -m \"A\" &&\n \n \t\tgit checkout B &&\n \t\tgit mv node1/ node2/ &&\n-\t\tfor i in `git ls-files`; do echo side B >>$i; done &&\n+\t\tfor i in $(git ls-files); do echo side B >>$i; done &&\n \t\tgit add -u &&\n \t\ttest_tick &&\n \t\tgit commit -m \"B\"\n@@ -4511,7 +4511,7 @@ test_setup_12c2 () {\n \n \t\tgit checkout A &&\n \t\tgit mv node2/ node1/ &&\n-\t\tfor i in `git ls-files`; do echo side A >>$i; done &&\n+\t\tfor i in $(git ls-files); do echo side A >>$i; done &&\n \t\tgit add -u &&\n \t\techo leaf5 >node1/leaf5 &&\n \t\tgit add node1/leaf5 &&\n@@ -4520,7 +4520,7 @@ test_setup_12c2 () {\n \n \t\tgit checkout B &&\n \t\tgit mv node1/ node2/ &&\n-\t\tfor i in `git ls-files`; do echo side B >>$i; done &&\n+\t\tfor i in $(git ls-files); do echo side B >>$i; done &&\n \t\tgit add -u &&\n \t\techo leaf6 >node2/leaf6 &&\n \t\tgit add node2/leaf6 &&\n@@ -4759,7 +4759,7 @@ test_setup_12f () {\n \t\techo g >dir/subdir/tweaked/g &&\n \t\techo h >dir/subdir/tweaked/h &&\n \t\ttest_seq 20 30 >dir/subdir/tweaked/Makefile &&\n-\t\tfor i in `test_seq 1 88`; do\n+\t\tfor i in $(test_seq 1 88); do\n \t\t\techo content $i >dir/unchanged/file_$i\n \t\tdone &&\n \t\tgit add . &&\n-- \n2.32.0\n\n"},{"id":"449133","messageId":"d9634657-1cd1-7daa-0b95-85b540f0dc75@github.com","threadId":"57456","inReplyTo":"20220222084646.115147-1-gitter.spiros@gmail.com","subject":"Re: [PATCH] t6423-merge-rename-directories.sh: use the $(...) construct for command substitution","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2022-02-22T14:06:03Z","receivedAt":"2022-02-22T14:06:51Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 2/22/2022 3:46 AM, Elia Pinto wrote:\n>     The Git CodingGuidelines prefer the $(...) construct for command\n>     substitution instead of using the backquotes `...`.\n> \n>     The backquoted form is the traditional method for command\n>     substitution, and is supported by POSIX.  However, all but the\n>     simplest uses become complicated quickly.  In particular, embedded\n>     command substitutions and/or the use of double quotes require\n>     careful escaping with the backslash character.\n\nThis message has some strange left-padding. Could you reduce that\nwhitespace for the majority of your message? \n\n>     The patch was generated by:\n> \n>         for _f in $(find . -name \"*.sh\")\n>         do\n>            shellcheck -i SC2006 -f diff ${_f} | ifne git apply -p2\n>         done\n\nHaving some left-padding makes sense for this example.\n\nAlso, thanks for sharing this automation!\n \n>     and then carefully proof-read.\n> -\t\tfor i in `git ls-files`; do echo side A >>$i; done &&\n> +\t\tfor i in $(git ls-files); do echo side A >>$i; done &&\n\n> -\t\tfor i in `git ls-files`; do echo side B >>$i; done &&\n> +\t\tfor i in $(git ls-files); do echo side B >>$i; done &&\n\n> -\t\tfor i in `git ls-files`; do echo side A >>$i; done &&\n> +\t\tfor i in $(git ls-files); do echo side A >>$i; done &&\n\n> -\t\tfor i in `git ls-files`; do echo side B >>$i; done &&\n> +\t\tfor i in $(git ls-files); do echo side B >>$i; done &&\n\n> -\t\tfor i in `test_seq 1 88`; do\n> +\t\tfor i in $(test_seq 1 88); do\n\nThese changes make sense. Thanks!\n-Stolee\n"}]}