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

Re: [PATCH] CodingGuidelines: Fix a typo

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 9, 2010, 17:51 UTC
Message-ID
<7v39sfuue3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20101009152758.GA17799@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 12 quoted lines
> stepnem@gmail.com wrote:
>
>> `${parameter/pattern/string}' shell expansion uses glob patterns, so
>> talking about `regexp' is confusing.
>
> Okay.
>
>> - - No regexp ${parameter/pattern/string}.
>> + - No substitution ${parameter/pattern/string}.
>
> A bit confusing, since ${parameter%word} and $parameter are
> substitutions, too.

I had the same reaction. Perhaps moving other parameter substitions closer to these two would help?

	Side note: this is totally unrelated, but the below is --patience;
	our output without --patience is almost unreadable in this case.
 Documentation/CodingGuidelines |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 8346c19..09ffc46 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -35,11 +35,22 @@ For shell scripts specifically (not exhaustive):
    properly nests.  It should have been the way Bourne spelled
    it from day one, but unfortunately isn't.
 
- - We use ${parameter-word} and its [-=?+] siblings, and their
-   colon'ed "unset or null" form.
+ - We use POSIX compliant parameter substitutions and avoid bashisms;
+   namely:
 
- - We use ${parameter#word} and its [#%] siblings, and their
-   doubled "longest matching" form.
+   - We use ${parameter-word} and its [-=?+] siblings, and their
+     colon'ed "unset or null" form.
+
+   - We use ${parameter#word} and its [#%] siblings, and their
+     doubled "longest matching" form.
+
+   - No "Substring Expansion" ${parameter:offset:length}.
+
+   - No shell arrays.
+
+   - No strlen ${#parameter}.
+
+   - No pattern replacement ${parameter/pattern/string}.
 
  - We use Arithmetic Expansion $(( ... )).
 
@@ -47,14 +58,6 @@ For shell scripts specifically (not exhaustive):
    of them, as some shells do not grok $((x)) while accepting $(($x))
    just fine (e.g. dash older than 0.5.4).
 
- - No "Substring Expansion" ${parameter:offset:length}.
-
- - No shell arrays.
-
- - No strlen ${#parameter}.
-
- - No regexp ${parameter/pattern/string}.
-
  - We do not use Process Substitution <(list) or >(list).
 
  - We prefer "test" over "[ ... ]".
Previous: Štěpán NěmecNext: Jonathan Nieder
Message 4 of 5 in “CodingGuidelines: Fix a typo”
  1. CodingGuidelines: Fix a typostepnem@gmail.com, Oct 9, 2010
  2. Jonathan NiederOct 9, 2010
  3. Štěpán NěmecOct 9, 2010
  4. Junio C HamanoOct 9, 2010
  5. Jonathan NiederOct 11, 2010

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.