diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-12-01 01:52:14 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-12-01 01:52:14 +0300 |
commit | 29fb21bb6a8359cbe566d16d9eca62aad9f8ea7d (patch) | |
tree | c55eb33314b55900335ee5055807acf4e4b8e6ec /%HOME% | |
parent | add an alias to clear the screen (diff) | |
download | linux-home-29fb21bb6a8359cbe566d16d9eca62aad9f8ea7d.tar.gz linux-home-29fb21bb6a8359cbe566d16d9eca62aad9f8ea7d.zip |
add Ubuntu detection
Diffstat (limited to '')
-rw-r--r-- | %HOME%/.bashrc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/%HOME%/.bashrc b/%HOME%/.bashrc index d8c709a..623146c 100644 --- a/%HOME%/.bashrc +++ b/%HOME%/.bashrc @@ -14,12 +14,35 @@ shopt -s histappend shopt -s nullglob shopt -s nocaseglob -_os="$( uname -o )" +_os='' + +detect_os() { + command -v uname > /dev/null \ + && [ "$( uname -o )" == 'Cygwin' ] \ + && _os='Cygwin' \ + && return 0 + + [ -r /etc/os-release ] \ + && _os="$( . /etc/os-release && echo "$NAME" )" \ + && return 0 + + return 1 +} + +detect_os + +os_detected() { + test -n "$_os" +} is_cygwin() { test "$_os" == 'Cygwin' } +is_ubuntu() { + test "$_os" == 'Ubuntu' +} + is_cygwin && set -o igncr export SHELLOPTS |