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

A shell script named build #501

Closed
jzinn opened this issue Feb 8, 2019 · 2 comments
Closed

A shell script named build #501

jzinn opened this issue Feb 8, 2019 · 2 comments
Labels
question Further information is requested

Comments

@jzinn
Copy link

jzinn commented Feb 8, 2019

Bat does not highlight a shell script with the file name build that contains a shebang line of #!/bin/bash.

Bat does highlight other shell scripts that lack a .sh extension, like run, setup, etc.

I suspect bat considers a file named build to be an NAnt build file.

Would it be possible to change the precedence so that bat will interpret my build script as a shell script?

@sharkdp
Copy link
Owner

sharkdp commented Feb 8, 2019

Bat does highlight other shell scripts that lack a .sh extension, like run, setup, etc.

I suspect bat considers a file named build to be an NAnt build file.

Yes, you are right. That's unfortunate.

Would it be possible to change the precedence so that bat will interpret my build script as a shell script?

Yes. You can add this to your config file:

--max-syntax build:bash

If you just want that behavior temporarily, you can always just use -l/--language:

bat build -lsh

@sharkdp sharkdp added the question Further information is requested label Feb 8, 2019
@jzinn
Copy link
Author

jzinn commented Feb 8, 2019

Oh snap, that works. (With --map-syntax.) Thanks.

I thought it would require a code change to get bat to look for shebangs in files without extensions before using the filename to determine the syntax.

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