mirror of
https://github.com/kvz/bash3boilerplate.git
synced 2025-05-02 16:32:50 +00:00
Better OS detection (#39)
This commit is contained in:
parent
bd49dda4b4
commit
03a2ec5adf
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
Released: Unreleased. [Commit log](https://github.com/kvz/bash3boilerplate/compare/v2.0.0...master)
|
Released: Unreleased. [Commit log](https://github.com/kvz/bash3boilerplate/compare/v2.0.0...master)
|
||||||
|
|
||||||
|
- Better OS detection (#38, thx @moviuro)
|
||||||
- Improve README copy (#34, thx galaktos)
|
- Improve README copy (#34, thx galaktos)
|
||||||
- Fix unquoted variable access within (#34 thx galaktos)
|
- Fix unquoted variable access within (#34 thx galaktos)
|
||||||
- For delete-key-friendliness, bundle the commandline definition block along with its parser
|
- For delete-key-friendliness, bundle the commandline definition block along with its parser
|
||||||
|
@ -156,6 +156,7 @@ Please see the [FAQ.md](./FAQ.md) file.
|
|||||||
- [@bravo-kernel](https://github.com/bravo-kernel) (feedback)
|
- [@bravo-kernel](https://github.com/bravo-kernel) (feedback)
|
||||||
- [@skanga](https://github.com/skanga) (feedback)
|
- [@skanga](https://github.com/skanga) (feedback)
|
||||||
- [galaktos](https://www.reddit.com/user/galaktos) (feedback)
|
- [galaktos](https://www.reddit.com/user/galaktos) (feedback)
|
||||||
|
- [@moviuro](https://github.com/moviuro) (feedback)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
15
main.sh
15
main.sh
@ -26,13 +26,20 @@ set -o pipefail
|
|||||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
||||||
__base="$(basename ${__file} .sh)"
|
__base="$(basename ${__file} .sh)"
|
||||||
__os="Linux"
|
|
||||||
if [[ "${OSTYPE:-}" == "darwin"* ]]; then
|
# The __os magic variable that b3bp offers is a dumbed down version of OSTYPE, aimed at
|
||||||
|
# simple use cases. For more specific os information use ${OSTYPE}, or uname directly.
|
||||||
|
if [[ "${OSTYPE:-}" == "linux"* ]]; then
|
||||||
|
__os="Linux"
|
||||||
|
elif [[ "${OSTYPE:-}" == "darwin"* ]]; then
|
||||||
__os="OSX"
|
__os="OSX"
|
||||||
fi
|
elif [[ "${OSTYPE:-}" == "msys" ]]; then
|
||||||
if [[ "${OSTYPE:-}" == "msys"* ]]; then
|
|
||||||
# This could accomodate Git Bash but we're welcoming more input at https://github.com/kvz/bash3boilerplate/issues/32
|
# This could accomodate Git Bash but we're welcoming more input at https://github.com/kvz/bash3boilerplate/issues/32
|
||||||
__os="Windows"
|
__os="Windows"
|
||||||
|
elif [[ "${OSTYPE:-}" == *"bsd"* ]]; then
|
||||||
|
__os="BSD"
|
||||||
|
else
|
||||||
|
__os="b3bp_unsupported"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Define the environment variables (and their defaults) that this script depends on
|
# Define the environment variables (and their defaults) that this script depends on
|
||||||
|
Loading…
x
Reference in New Issue
Block a user