Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not minify case statements well. #3

Open
fidian opened this issue Jul 31, 2017 · 0 comments
Open

Does not minify case statements well. #3

fidian opened this issue Jul 31, 2017 · 0 comments

Comments

@fidian
Copy link

fidian commented Jul 31, 2017

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 ;;.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant