I'm working in an HPC cluster which has a lot of partitions ($HOME, $SCRATCH, $WORKDIR, $SHARED,...) and was trying to find a way to clearly identify which partition I'm at the moment.
After some digging, I found that
export PS1="\e[33;1m\u@\h: \e[31m\w\e[0m\$ "
would show me what I'm looking for. However, the path becomes really cumbersome since all of these partitions have a really long pwd
output.
I found out that this command,
aaa@bbb: ~$ echo $PROMPT_COMMAND
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" ${PWD/#$HOME/~}"
mainly the ${PWD/#$HOME/~}
part, might be why the $HOME
directory appears simply with ~
.
Is there a way to change this environment variable (or any other alternative) for me to have something like:
aaa@bbb: ~/foo/bar$ # when I'm working in $HOME
aaa@bbb: scratch/foo/bar$ # when I'm working in $SCRATCH
aaa@bbb: shared/foo/bar$ # when I'm working in $SHARED