|
|
|
|
|
by lowry
2707 days ago
|
|
Truncate the $PWD to ΒΌ of the terminal width and put the result into the command prompt: # truncate the $PWD
function cut_pwd
{
newPWD="${PWD/#$HOME/\~}"
local pwdmaxlen=$((${COLUMNS:-80}/4))
if [ ${#newPWD} -gt $pwdmaxlen ]
then
newPWD=".+${newPWD: -$pwdmaxlen}"
fi
}
PROMPT_COMMAND=cut_pwd
PS1="\h:\${newPWD} \\$ "
|
|