From 695992cade21415f7fb056c7ec129a02ab673afb Mon Sep 17 00:00:00 2001 From: Khalid Zubair Date: Mon, 8 Feb 2016 16:27:55 -0800 Subject: envsetup: add function to detect shell Add a function to detect shell, other functions can now use this to handle shell specific behavior. Change-Id: I4aabc0068e836c5433053b144d163fb0ed49f752 --- envsetup.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'envsetup.sh') diff --git a/envsetup.sh b/envsetup.sh index c62a57f..35dc8e1 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -2457,16 +2457,25 @@ function make() mk_timer $(get_make_command) "$@" } -if [ "x$SHELL" != "x/bin/bash" ]; then +function __detect_shell() { case `ps -o command -p $$` in *bash*) + echo bash ;; *zsh*) + echo zsh ;; *) - echo "WARNING: Only bash and zsh are supported, use of other shell may lead to erroneous results" + echo unknown + return 1 ;; esac + return +} + + +if ! __detect_shell > /dev/null; then + echo "WARNING: Only bash and zsh are supported, use of other shell may lead to erroneous results" fi # Execute the contents of any vendorsetup.sh files we can find. -- cgit v1.1