Skip to content

Commit

Permalink
Fix to check bash version before install (#28)
Browse files Browse the repository at this point in the history
* Fix to check bash version before install

* Fix for non-zero exit status
  • Loading branch information
natarajmb authored and nntoan committed Aug 13, 2018
1 parent 246d698 commit e66772b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions oh-my-bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,5 @@ if ! type_exists '__git_ps1' ; then
fi

# Adding Support for other OSes
PREVIEW="less"
[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview"
[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app"
[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" ||
[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" || PREVIEW="less"
11 changes: 11 additions & 0 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ main() {
# which may fail on systems lacking tput or terminfo
set -e

# Checks the minium version of bash (v4) installed,
# stops the installation if check fails
if [ -n $BASH_VERSION ]; then
bash_major_version=$(echo $BASH_VERSION | cut -d '.' -f 1)
if [ "${bash_major_version}" -lt "4" ]; then
printf "Error: Bash 4 required for Oh My Bash.\n"
printf "Error: Upgrade Bash and try again.\n"
exit 1
fi
fi

if [ ! -n "$OSH" ]; then
OSH=$HOME/.oh-my-bash
fi
Expand Down

0 comments on commit e66772b

Please sign in to comment.