Skip to content

Commit

Permalink
OS detection without launching external uname process
Browse files Browse the repository at this point in the history
  • Loading branch information
gioele committed Aug 11, 2012
1 parent d73d4fc commit b3aa604
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bashrc_dispatch
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@
SHELL_FOR=$$

export SHELL_PLATFORM='OTHER'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then SHELL_PLATFORM='LINUX';
elif [[ "$unamestr" == 'Darwin' ]]; then SHELL_PLATFORM='OSX';
fi
case "$MACHTYPE" in
*'linux'* ) SHELL_PLATFORM='LINUX' ;;
*'darwin'* ) SHELL_PLATFORM='OSX' ;;
*'freebsd'* ) SHELL_PLATFORM='BSD' ;;
esac

if [ -z "$SHELL_DISPATCH_FUNCTIONS" ]; then
shell_is_linux () { return `[[ "$SHELL_PLATFORM" == 'LINUX' ]]`; }
Expand Down

0 comments on commit b3aa604

Please sign in to comment.