crowbar/crowbar-core

View on GitHub
chef/cookbooks/provisioner/templates/default/zzz-prompt.sh.erb

Summary

Maintainability
Test Coverage
if test "$UID" = 0; then
    prompt_suffix="#"
else
    prompt_suffix=">"
fi

# Only set the crazy prompt on terminals that support colors
# it looks horrible on monochromatic terminals

if test $(tput colors 2> /dev/null || echo 0) -ge 8; then
    case $(readlink /proc/$$/exe 2>/dev/null) in
        */zsh)
            PS1=$'<%= @zsh_prompt_from_template.call %> '
            ;;

        */bash)
            PS1="<%= @bash_prompt_from_template.call %> "
            ;;

        */ash|*/dash)
            PS1="<%= @prompt_from_template.call("${USER}", "${PWD}") %> "
            ;;

        */ksh|*/ksh93)
            PS1="<%= @prompt_from_template.call("${USER}", "${PWD}") %> "
            ;;

        */pdksh|*/*pcksh)
            PS1="<%= @prompt_from_template.call("${USER}", "${PWD}") %> "
            ;;

        */*)
            PS1="<%= @prompt_from_template.call("\\u", "\\w") %> "
            ;;
    esac
fi