git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t6423-merge-rename-directories.sh: use the $(...) construct for command substitution

From
Derrick Stolee <derrickstolee@github.com>
Date
Feb 22, 2022, 14:06 UTC
Message-ID
<d9634657-1cd1-7daa-0b95-85b540f0dc75@github.com>
In-Reply-To
<20220222084646.115147-1-gitter.spiros@gmail.com>
On 2/22/2022 3:46 AM, Elia Pinto wrote:
Show 8 quoted lines
>     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?

Show 6 quoted lines
>     The patch was generated by:
> 
>         for _f in $(find . -name "*.sh")
>         do
>            shellcheck -i SC2006 -f diff ${_f} | ifne git apply -p2
>         done
Having 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

Previous: Elia Pinto
Message 2 of 2 in “t6423-merge-rename-directories.sh: use the $(...) construct for command substitution”
  1. t6423-merge-rename-directories.sh: use the $(...) construct for command substitutionElia Pinto, Feb 22, 2022
  2. Derrick StoleeFeb 22, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.