Como fazer a minha sessão bash do PS1 mostrar todo o pwd em todos os momentos?

0

Relevante seção .bashrc :

if [ "$color_prompt" = yes ]; then
    if [[ ${EUID} == 0 ]] ; then
        PS1='${debian_chroot:+($debian_chroot)}\[3[01;31m\]\h\[3[01;34m\] \W \$\[3[00m\] '
    else
        PS1='${debian_chroot:+($debian_chroot)}\[3[01;32m\]\u@\h\[3[00m\] \[3[01;34m\]\w \$\[3[00m\] '
    fi
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h \w \$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h \w\a\]$PS1"
    ;;
*)
    ;;
esac

A pergunta é, como eu faço para não encurtar o pwd se no diretório home, então mostre todo o pwd o tempo todo no PS1.

    
por Vlastimil 02.02.2018 / 07:52

1 resposta

2

Resolvido com a substituição de \w e \W no PS1 por $PWD :

if [ "$color_prompt" = yes ]; then
    if [[ ${EUID} == 0 ]] ; then
        PS1='${debian_chroot:+($debian_chroot)}\[3[01;31m\]\h\[3[01;34m\] $PWD \$\[3[00m\] '
    else
        PS1='${debian_chroot:+($debian_chroot)}\[3[01;32m\]\u@\h\[3[00m\] \[3[01;34m\]$PWD \$\[3[00m\] '
    fi
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h $PWD \$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h \$PWD\a\]$PS1"
    ;;
*)
    ;;
esac
    
por 02.02.2018 / 07:52