diff options
author | Khalid Zubair <kzubair@cyngn.com> | 2016-02-08 16:27:55 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2016-02-20 09:07:14 -0800 |
commit | 695992cade21415f7fb056c7ec129a02ab673afb (patch) | |
tree | 793dcc954ff56fb5ca1547898effed7b28b878ff /envsetup.sh | |
parent | ebddb95a1606b4ab5087e8ddbaf231ae3bf18c22 (diff) | |
download | build-695992cade21415f7fb056c7ec129a02ab673afb.zip build-695992cade21415f7fb056c7ec129a02ab673afb.tar.gz build-695992cade21415f7fb056c7ec129a02ab673afb.tar.bz2 |
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
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 13 |
1 files changed, 11 insertions, 2 deletions
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. |