Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #213. There are several issues in the current install script. This PR tries to fix them. I separated commits for each fixes as follows. Thank you.
Add support for termcap-based tput 02620c8
As I have already commented in ***,
tput
may supporttermcap
names instead ofterminfo
names depending on the system.Also, I have changed
which
tohash
as is later used to testgit
.which
is not a POSIX utility, so it may be missing.hash
is a builtin command of Bash so always available while running in Bash.The right-hand sides of assignments is not subject to word splitting or pathname expansions, so quotation is unneeded for the command substitutions.
Fix the version check 03ee310
In Bash and POSIX shells (unlike the default of Zsh), the unquoted parameter expansion
$BASH_VERSION
is subject to word splitting and pathname expansions. WhenBASH_VERSION
is an empty string, it will be[ -n ]
. When[ ... ]
receives only a single argument, it just tests whether the argument is non-empty. It just tests if the string-n
is non-empty, which is always true. One needs to quote$BASH_VERSION
.Also, we should first test the shell version outside the function because less-functional shells may fail to parse the function itself before it checks the shell version in the function. For example, the original Bourne shell doesn't understand the command substitution of the form
$(...)
.In case it matters, the version check code was introduced by e66772b.
Quote arguments properly 599e277
In Bash and POSIX shells (unlike the default of Zsh), the unquoted arguments undergo word splitting and pathname expansions. For example, the unquoted
$HOME
will be split to multiple words whenHOME
contains spaces or whenIFS
contains characters inHOME
.Also, instead of quoting
$HOME
, one may use~
in the beginning of words and right-hand sides of assignments.Use conditional command 2f2a12d
In Bash, instead of
[
, it is recommended to use the special compound command[[ ... ]]
, for which the syntactic treatment of the arguments are different from the one in the normal context.