Bash: fix prompt and enable autocd

Prompt fix: see http://tldp.org/HOWTO/Bash-Prompt-HOWTO/nonprintingchars.html
This commit is contained in:
2015-12-06 10:26:33 +01:00
parent c8837c6556
commit 9913ac8754

View File

@@ -52,7 +52,7 @@ PS1="$PS1\h "
PS1="$PS1"'$(if [ -L "$PWD" ]; then echo -ne "\[$On_Blue\]"; fi)'
# DYNAMIC: pwd in title
PS1="$PS1"'$(title \W)'
PS1="$PS1"'\[$(title \W)\]'
# DYNAMIC: wd length < 6 (/, /etc, /usr, /var, /home etc) brings red wd name
PS1="$PS1"'$(if [ ${#PWD} -lt 6 ]; then echo -ne "\[$BRed\]"; else echo -ne "\[$BGreen\]"; fi)\W'
@@ -266,6 +266,8 @@ upload() {
echo http://bin.dget.cc/$(curl -X POST --data-binary @"$1" http://bin.dget.cc/ | tail -3 | head -1 | cut -d'"' -f2)
}
shopt -s autocd
trap 'title "$BASH_COMMAND"' DEBUG
# vim: ft=sh