Skip to content

Commit

Permalink
fix: use current shell if bash/zsh (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmccaffery authored Dec 18, 2019
1 parent e7b9009 commit f3834ee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
19 changes: 18 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,24 @@ __am_prompt_install() {

echo $PROMPT_SHA > $PROMPT_SHA_PATH

local PROMPT_SHELL="${1:-"bash"}"
# get the requested shell
local PROMPT_SHELL="${1:-}"

# determine if the request shell was not set
if [ -z "${PROMPT_SHELL:-}" ]; then

# get the current shell
PROMPT_SHELL=$(echo $SHELL | rev | cut -d'/' -f1 | rev)

# test if the current shell is something other than zsh
if [ "$PROMPT_SHELL" != "zsh" ]; then

# default to bash
PROMPT_SHELL="bash"
fi
fi

# lowercase the prompt shell
local PROMPT_SHELL=$(echo $PROMPT_SHELL | tr '[:upper:]' '[:lower:]')

# use the correct shell
Expand Down
3 changes: 3 additions & 0 deletions src/bash/bashrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

# set prompt shell
export PROMPT_SHELL="bash"

# shell options
shopt -s checkwinsize # check window size on script exit
shopt -s cdable_vars # enable change directory to a variable value
Expand Down
3 changes: 3 additions & 0 deletions src/zsh/zshrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env zsh

# set prompt shell
export PROMPT_SHELL="zsh"

# determine if this is a tty
if [ -t 1 ]; then

Expand Down

0 comments on commit f3834ee

Please sign in to comment.