Skip to content

Shell script: # followed by non-whitespace may or may not be comment #24

@J-Siu

Description

@J-Siu

Version 1.13.1

When Remove All Comments, following line (from p10k.zsh):

(( $#branch > 32 )) && branch[13,-13]="…"  # <-- this line

becomes:

(( $

The correct outcome should be:

(( $#branch > 32 )) && branch[13,-13]="…"

Additional information:

  1. In shell script(posix), if # immediately followed by non-white-space, it may or may not not be comment.
  2. Complexity of shell script:
    # Following line does not contain comment
    cat file | grep -v -e ^# -e ^$
    # Following line is partial comment
    cat file | grep -v -e ^# -e ^$ ### This part is a comment
    

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