Skip to content

Does not minify case statements well. #3

Description

@fidian

Input script:

#!/usr/bin/env bash
case "$PATH" in
    thing)
        echo "Shouldn't match this."
        ;;
esac

Resulting minified code:

case "$PATH" in thing);echo "Shouldn't match this.";;;esac

Bash's error:

bash: test.min: line 1: syntax error near unexpected token `;'
bash: test.min: line 1: `case "$PATH" in thing);echo "Shouldn't match this.";;;esac'

There shouldn't be a semicolon after the close parenthesis. Also, the three ;;; in a row cause a problem. Here's the fixed version:

case "$PATH" in thing) echo "Shouldn't match this." ;; esac

Also, you might need to treat ;& and ;;& because they parse similarly to ;;.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to 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