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

Shellcheck does not allow for shebangs with a space #47

Open
thibmaek opened this issue Dec 16, 2020 · 7 comments
Open

Shellcheck does not allow for shebangs with a space #47

thibmaek opened this issue Dec 16, 2020 · 7 comments
Labels
question Further information is requested

Comments

@thibmaek
Copy link

The custom regex check will fail if the shebang is in the format of #! /usr/bin/bash and only work when removing the space e.g #!/usr/bin/bash.

Spaces in shebangs are valid.

@brikis98 brikis98 added the question Further information is requested label Dec 17, 2020
@brikis98
Copy link
Member

Do we have a script with a space after the shebang somewhere?

@thibmaek
Copy link
Author

Not in this repo maybe, but if I try to use this hook in a repo it will not work unless removing the space.
I tried to test by changing the regex and validating on regexr but I'm not sure which format of regex that is (PCRE?)

@brikis98
Copy link
Member

Ohhh, I think I misunderstood. What you're saying is that the regex we use to identify shell scripts is what would need to be fixed?

@thibmaek
Copy link
Author

Yep indeed, the regex needs to option to allow a space between right after the bang symbol:

  • regex validates: #!/usr/bin/env bash
  • regex invalidates: #! /usr/bin/env bash

@brikis98
Copy link
Member

brikis98 commented Jan 6, 2021

Understood! And, indeed, spaces after shebang are allowed, as you mentioned. Would you be up for a PR to tweak the regex?

@thibmaek
Copy link
Author

thibmaek commented Jan 6, 2021

Yeah sure, do you know what format the regex is? I tried it on regexr but it didn't validate. Maybe its perl regex?

@brikis98
Copy link
Member

brikis98 commented Jan 7, 2021

It's grep format: https://stackoverflow.com/a/4192817/483528.

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

No branches or pull requests

2 participants