Skip to content

Binary left shift inside arithmetic dollar #124

@aljames-a12

Description

@aljames-a12

The code with a problem is:

#!/bin/bash

# 1. Normal arithmetic works fine
count=$(( 1 + 1 ))
echo "Count is $count"

# 2. BUG: Binary left shift inside arithmetic expression breaks highlighting
# The parser might be interpreting '<<' as the start of a here-doc, rather than
# a left-shift causing everything following it to be colored as a string.
shift_val=$(( 1 << 4 ))

# 3. The rest of the file is then incorrectly color coded
echo "Shift value is $shift_val"

exit 0

It looks like:

Image

It should look like:

Image

Local grammar changes made to arrive at the above can be provided - though I can not guarantee they do not have additional side effects I have not tested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions