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

Already on GitHub? Sign in to your account

Change mac and linux files to have .sh extension #169

Closed
croaky opened this Issue Nov 26, 2013 · 10 comments

Comments

Projects
None yet
5 participants
Owner

croaky commented Nov 26, 2013

So syntax highlighting will work, particularly in browser/GitHub, particularly for user's who want to peruse exactly what the script does.

Owner

mike-burns commented Nov 26, 2013

Shouldn't it be .zsh instead?

Contributor

pbrisbin commented Nov 26, 2013

In general, I'm against extensions on executable scripts. However, if syntax highlighting on GitHub is worth it, and that's the only objective, .sh seems as good as anything. I have no problem if someone thinks .zsh (and eventually .bash) is better though.

Owner

mike-burns commented Nov 26, 2013

Does a modeline solve it?

Contributor

pbrisbin commented Nov 27, 2013

I'd be surprised if GH picked up a modeline but not a shebang, but maybe?

GH uses linguist/pygments which reads the extension and falls back to lexing the entire file so if you have a lot of non-bash in your script it may detect incorrectly

Contributor

pbrisbin commented Nov 27, 2013

It seems to be hit or miss. For example: this highlights fine without an extension as does this. I'd be curious if it just starts working when we give it a bash shebang.

Owner

mike-burns commented Nov 27, 2013

Right, very few things will highlight based on a /usr/bin/env shebang line.

Is there a standard location for bash? I assume it's /usr/local/bin/bash.

Contributor

pbrisbin commented Nov 27, 2013

Not to my knowledge. Usually, it's /usr/bin/bash, Arch has moved to a single /bin for all things (but provides symlinks from /usr/bin and /usr/local/bin for temporary backwards compatability).

I was hoping the lexer might have noticed /usr/bin/env bash (which the second link above uses) but just not /usr/bin/env zsh, but it seems not. If I had to guess, it's the odd indentation of commands under fancy_echo that's throwing it off.

Owner

mike-burns commented Nov 27, 2013

Pygments doesn't support zsh: http://pygments.org/languages/

Contributor

djcp commented Apr 4, 2014

I don't think we have a compelling reason for / against this so I'm going to close.

@djcp djcp closed this Apr 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment