Comment by xorcist
9 hours ago
Not to rain on your fine snippet but you can use negative offsets to index from the end of the string:
P="$PWD"
[ ${#P} -gt $pwdmaxlen ] && P="$trunc_symbol${P: -$pwdmaxlen}"
9 hours ago
Not to rain on your fine snippet but you can use negative offsets to index from the end of the string:
P="$PWD"
[ ${#P} -gt $pwdmaxlen ] && P="$trunc_symbol${P: -$pwdmaxlen}"
No comments yet
Contribute on Hacker News ↗