From 6f96f35adc5cd389cd5647ef9d15174ce8fd580a Mon Sep 17 00:00:00 2001 From: Martin Bagge / brother Date: Thu, 27 Aug 2020 22:15:28 +0200 Subject: [PATCH] Rationale and example adopted from SC1054. Hopefully accurate. --- SC1056.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/SC1056.md b/SC1056.md index 57529c0..a02091b 100644 --- a/SC1056.md +++ b/SC1056.md @@ -1,22 +1,20 @@ ## Expected a '}'. If you have one, try a ; or \\n in front of it. -NEEDS WORK. Adding the boiler plate to avoid confusion. - ### Problematic code: ```sh -true +#!/bin/bash +bar() { echo "hello world"} ``` ### Correct code: ```sh -true +#!/bin/bash +bar() { echo "hello world";} ``` ### Rationale: -? +`}` is only recognized as the end of a command group when it's a separate token. -### Exceptions: - -? \ No newline at end of file +If it's not a separate token, like in the problematic example, it will be considered a literal character, as if writing `echo "foo}"` with quotes, and therefore usually cause a syntax error. \ No newline at end of file