Skip to content

Commit

Permalink
Merge pull request #2 from bsutic/master
Browse files Browse the repository at this point in the history
Add cygwin support
  • Loading branch information
josephwecker committed Dec 17, 2012
2 parents cbd4f26 + a78c692 commit 4829252
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ Exported Stuff

In addition to the dispatching, you'll forever have the following available:

* `$SHELL_PLATFORM` (either `LINUX`, `OSX`, `BSD` or `OTHER`),
* `$SHELL_PLATFORM` (either `LINUX`, `OSX`, `BSD`, `CYGWIN` or `OTHER`),
* `shell_is_linux`,
* `shell_is_osx`,
* `shell_is_cygwin`,
* `shell_is_interactive`,
* `shell_is_script`.

Expand Down
6 changes: 5 additions & 1 deletion bashrc_dispatch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Launch different bash configuration for Linux vs OSX, interactive vs batch
#
Expand Down Expand Up @@ -32,12 +32,14 @@ if [ -z "$SHELL_PLATFORM" ]; then
*'linux'* ) SHELL_PLATFORM='LINUX' ;;
*'darwin'* ) SHELL_PLATFORM='OSX' ;;
*'freebsd'* ) SHELL_PLATFORM='BSD' ;;
*'cygwin'* ) SHELL_PLATFORM='CYGWIN' ;;
esac
fi

if ! type -p shell_is_login ; then
shell_is_linux () { [[ "$OSTYPE" == *'linux'* ]] ; }
shell_is_osx () { [[ "$OSTYPE" == *'darwin'* ]] ; }
shell_is_cygwin () { [[ "$OSTYPE" == *'cygwin'* ]] ; }
shell_is_login () { shopt -q login_shell ; }
shell_is_interactive () { test -n "$PS1" ; }
shell_is_script () { ! shell_is_interactive ; }
Expand All @@ -55,6 +57,7 @@ if $EXPORT_FUNCTIONS ; then
export SHELL_PLATFORM
export -f shell_is_linux
export -f shell_is_osx
export -f shell_is_cygwin
export -f shell_is_login
export -f shell_is_interactive
export -f shell_is_script
Expand All @@ -76,6 +79,7 @@ if ! $EXPORT_FUNCTIONS ; then
unset SHELL_PLATFORM
unset -f shell_is_linux
unset -f shell_is_osx
unset -f shell_is_cygwin
unset -f shell_is_login
unset -f shell_is_interactive
unset -f shell_is_script
Expand Down

0 comments on commit 4829252

Please sign in to comment.