You are using some unusual bash syntax that I've personally never seen
before, and doesn't appear to be documented in the bash(1) man page.


>    echo  $[offset+${diffs[$[MaxLevel-level]]}]

You are using `$[...]` to do arithmetic expansion, but this is not the
documented syntax for arithmetic expansion. According to the man page,
you should use `$((...))` for this, and indeed, that's the only way I've
ever seen it. A quick Google search revealed that the syntax with square
brackets is an old, deprecated form that should no longer be used. If
you instead use the documented syntax on line 15, the strange
highlighting goes away.


> function display_curve {
>    local ln1="Level: "
>     local ln2="Keep4: "
>    local -i l
>    for ((l = MaxLevel; l>=0; --l)) {
>        printf -v ln1 "%s %2d" "$ln1" "$l"
>        printf -v ln2 "%s %2d" "$ln2" "$(weeks_to_keep_level $l)"
>    }
>    echo -e "$ln1\n$ln2"
> }

In the other case, where a brace is highlighted strangely, the brace is
closing a function containing an unusual for loop. You are delimiting
the body of your loop with braces, like:

    for ... {
        ...
    }

but the correct for loop syntax in bash is:

    for ...; do
        ...
    done

Again, if you replace the loop in the `display_curve` function with the
correct, modern syntax, the strange highlighting disappears.

Attachment: pgpalvDyypnqd.pgp
Description: PGP signature

Reply via email to