Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use current shell if bash/zsh #39

Merged
merged 2 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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