Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there any reason this should have #!/bin/bash as the shebang instead of #!/bin/sh ?

Especially considering it has the extension of .sh instead of .bash



I don't think I've ever seen a script use a.bash extension, so I wouldn't put any weight on that.


If I'm using bashisms, I'll use .bash extension. It's rare indeed, but that's because I'm trying to stay in pure sh way.


I only use .sh extensions for Bourne shell scripts and .bash for Bash scripts. It doesn't really matter in terms of executing scripts, but it's a handy visual indication.


Usually you don't put any extension on scripts that use a shebang (#!), so that you can chmod +x them, put them in your path, and use them like normal commands (which don't have a suffix).

IMHO the .sh extension should only be used for code that you're supposed to "source" instead of executing.


Downloaded scripts do generally have extensions, and they are almost exclusively .eh, which was the point of my comment.


Only if they are Canadian scripts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: