The last subdirectory of $HOME
Following this post:
http://www.linuxquestions.org/questi...09#post5569609 I want to set PROMPT_COMMAND so the it will contain only the last subdirectory of $HOME. Right now its: Code:
PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${PWD/#$HOME/~}"' Code:
export PS1="\u@\W>" Code:
export PS1="\u@\w>" Thank you |
What have you tried so far?
|
|
Quote:
By the way, which shell are you using? Have you looked at basename? |
Adding basename
Code:
PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" `basename "${PWD/#$HOME/~}"`' Code:
unset PROMPT_COMMAND |
Quote:
Code:
PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" ${PWD##$HOME*/}' |
Quote:
Code:
PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" ${PWD##*/}' But the own homedir is not printed as ~ then. |
Quote:
Quote:
|
All times are GMT -5. The time now is 10:50 AM. |