diff --git a/yadm b/yadm index 0d82f00..57c28a0 100755 --- a/yadm +++ b/yadm @@ -433,10 +433,25 @@ function encrypt() { } function enter() { - require_repo - echo "Entering repo" - $SHELL - echo "Leaving repo" + require_shell + require_repo + + shell_opts="" + shell_path="" + if [[ "$SHELL" =~ bash$ ]]; then + shell_opts="--norc" + shell_path="\w" + elif [[ "$SHELL" =~ [cz]sh$ ]]; then + shell_opts="-f" + shell_path="%~" + fi + + echo "Entering yadm repo" + + yadm_prompt="yadm shell ($YADM_REPO) $shell_path > " + PROMPT="$yadm_prompt" PS1="$yadm_prompt" "$SHELL" $shell_opts + + echo "Leaving yadm repo" } function git_command() { @@ -796,6 +811,9 @@ function require_ls() { LS_PROGRAM=ls fi } +function require_shell() { + [ -x "$SHELL" ] || error_out "\$SHELL does not refer to an executable." +} function bootstrap_available() { [ -f "$YADM_BOOTSTRAP" ] && [ -x "$YADM_BOOTSTRAP" ] && return return 1