在 终端上使用 bash 的shell 终端时,如果显示全路径在用小窗口时很不方便:
erc@V450:/opt/poot/python$
erc@V450:/opt/poot/python/branches/parse/redis-store/dbs$
erc@V450:/opt/poot/python/branches/parse/redis-store/dbs$
erc@V450:/opt/poot/python/branches/parse/redis-store/dbs$
做一点小修改 , 可以只显示当前路径:
erc@V450:query$
erc@V450:dbs$
修改 ~/.bashrc 中PS1的值即可。 \w表示绝对路径, \W表示当前的目录.
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
fi