Hi
I have a prompt like this:
PS1='\[\e[1;33m\]\u@\h \[\e[1;34m\]\w $(es=$?; [[ $es -ne 0 ]] && echo "\[\e[1;31m\]" || echo "\[\e[1;32m\]")[$(ls | wc -l):$(($(ls -ad .* | wc -l)-2))]\$\[\e[0m\]'
It works like it should, but have a bug.
Problem is the counting of hidden files
$(($(ls -ad .* | wc -l)-2))
echo $(($(ls -ad .* | wc -l)-2))
The . seems to create the problem when I cut and past to the screen.
It works correct, but gives extra/wrong character displayed on my screen.
Simple test
echo $PS1
in my home folder gives:
\[\e[1;33m\]\u@\h \[\e[1;34m\]\w $(es=$?; [[ $es -ne 0 ]] && echo "\[\e[1;31m\]" || echo "\[\e[1;32m\]")[$(ls | wc -l):$(($(ls -ad . .. .aptitude .bash_history .bashrc .cache .nano_history .ncftp .profile .selected_editor .ssh .subversion | wc -l)-2))]\$\[\e[0m\]
The extra is in red
Is there another way to get correct hidden files, that does not create this mess?