git://git.iain.cx/iain
/
profile.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
909140c
)
Handle the case where $HOME has a trailing slash.
author
Iain Patterson
<me@iain.cx>
Wed, 16 Mar 2016 10:04:34 +0000
(10:04 +0000)
committer
Iain Patterson
<me@iain.cx>
Wed, 16 Mar 2016 10:05:58 +0000
(10:05 +0000)
$HOME should not have a trailing slash. But if it does we would eat it
in __ps1_short() and leave an incorrect prompt.
.profile.d/ps1.bashrc
patch
|
blob
|
history
diff --git
a/.profile.d/ps1.bashrc
b/.profile.d/ps1.bashrc
index
7bd93b7
..
4f249c9
100644
(file)
--- a/
.profile.d/ps1.bashrc
+++ b/
.profile.d/ps1.bashrc
@@
-200,7
+200,8
@@
function __ps1_colon() {
}
function __ps1_short() {
- local pwd=${PWD/#$HOME/\~}
+ local home=${HOME%%/}
+ local pwd=${PWD/#$home/\~}
local dirtrim=${PROMPT_DIRTRIM//[^0-9]/}
if [ "${dirtrim:0:1}" = "0" ]; then