Color prompt with file numbers does not work anymore
I have used this color prompt on my servers for long time, in file ~\.bashrc
It gives a prompt like this
The numbers [5:2] tells me there are 5 normal files and 2 hidden.
For some reason this does not work anymore when I change directory. I am not sure when this has stopped working. If run the PS1 variable manually, it updates the file number, but this should go automatically.
Anyone could test this as see if it works or not.
I do run my server on Ubuntu 32 and 64 bits 12.04
Thanks you for looking at this, but your solution broke other stuff. It now shows correct visible files in a folder.
This part $(($(ls -ad .* | wc -l)-2)) does not more list the hidden files. Test in home folder.
\$([ \$? = 0 ] && echo -e '$LGreen#$Reset' || echo -e '$LRed#$Reset'\)
Exit code no longer change color on # from green to red when some is wrong.
\$(($(ls -ad .* | wc -l)-2))
This works some, but only give correct number of files when its run.
Changing folder does not update the numbers.
---------- Post updated at 09:49 ---------- Previous update was at 09:08 ----------
New version that do work. (did copy some from internet)
Thanks you for looking at this, but your solution broke other stuff.
It didn't.
The other stuff was already broken given the fact I didn't change anything elsewhere and my change doesn't impact but the number of non hidden files displayed.
Hi,
I'm trying to customize the ksh prompt for users on a RHEL 6.6 system for having user@host pwd : $ and user@host pwd # in red color for root.
I think it's possible but i do not even succeded for a non root user :
I added in my ~/.kshrc :
PS1="Hello : " and it works
but when i... (4 Replies)
Hi,
Since a year my libvirtd does not work anymore on my Gentoodesktop. In the meantime a used virtualbox. But I would like to have back libvirt. The problem was after libvirt should not only work with root privileges. I deinstalled all things with libvirt an kvm. I removed all things from /var... (4 Replies)
Hi!
I am using latest ZSH and I have setopt prompt_subst
I have a global hash array variable which contains some color definitions with color names as keys and 256-color ANSI codes (with %{ and %}) as values, eg %{\ePS1="$FG Hello World (%M) > "
or
PS1=$'$FG Hello World (%M) > '
then it... (3 Replies)
Hi,
When I run:
echo "\033I see hi in color, but if I run this color is not shown, why?
(echo "\033Thanks
Israel.
---------- Post updated at 05:17 AM ---------- Previous update was at 04:43 AM ----------
DONE!!
I had to run more -v.
Thanks (4 Replies)
Just wondering if someone could assist me with shell script I'm trying to write. I need to read the final column of a text file (shown below) and workout what the average number is. The text file will have a variable number of lines, I just want the script to pull out the values in the final field... (14 Replies)
Hi folks
This is our prompt at the moment
oracle@pinkipinki:/opt/oracle> grep 'set prompt' .cshrc
set prompt = "$user@`uname -n`:$cwd> "
We wish to have in production the same prompt, but red.
Howto do that? I tried a lot a internet manuals, but it doesn't work. (1 Reply)
Hello,
first of all, I want to make myself clear about my language. I'm brazilian, so I ask you all to understand if i commit any mistake with the grammar.
Here is the problem.
Some days ago I needed to use a "sh" command in the Terminal (I use a Mac OSX 10.5.6) followed by a file... (0 Replies)
Hi all,
Can you tell me how to change the prompt color (only the path part) when I chnange directory with "cd"?
I use the sequence below in ".bashrc" (Solaris 8) to change my prompt colors and I'd like to modify it to change the path color when I cange directory.
PSC() { echo -ne "\"; }... (0 Replies)