gitblit
gitblit copied to clipboard
replace /bin/bash with /bin/sh for more compatibility
Originally reported on Google Code with ID 554
your shell scripts to start and stop gitblit work with a simple sh shell, so there is
no need to force bash. /bin/sh is available on every UNIX and UNIX-like system, while
/bin/bash is not (e.g. FreeBSD).
I would suggest replacing
#!/bin/bash
with
#!/bin/sh
in the scripts which are part of gitblit go.
in service-centos.sh (works on FreeBSD, too) the only change you need to do is replace
source ${GITBLIT_PATH}/java-proxy-config.sh
with
. ${GITBLIT_PATH}/java-proxy-config.sh
Reported by oliverkett
on 2015-01-29 20:53:04
I'm not opposed to this idea, but I don't currently plan to change it. I'm not expert
enough on all the variations in shell syntax. I'm sure "." is available in most if
not all shells, but what about conditionals and switches? Is that the same between
bash, csh, zsh, fish, etc, etc? I'm not totally sure.
Reported by James.Moger
on 2015-02-26 14:17:27
well, /bin/sh on all systems I know is either ash, ksh, bash or dash (all sh compatible).
If it would be a shell with non-sh-like syntax even the boot-process would fail as
it does depends massively on sh scripts. E.g. look at /etc/init.d on Ubuntu. Most of
these scripts using /bin/sh (= dash on ubuntu) as interpreter.
for a overview on what's defined in the sh language, look here:
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html
TL;DR: Most syntatic features from bash are available in sh, with a few differences
like substrings in variables, etc. Nothing you would probably need in an init script.
Another option would be to use #!/usr/bin/env bash - which, while not POSIX compliant,
works on every half-way modern unix system and calls the bash from their correct path
(e.g. on FreeBSD /usr/local/bin/bash, if installed from ports).
Reported by oliverkett
on 2015-03-02 14:49:19